Page 1 of 1

when does a record "fall out" of an index?

Posted: Tue Jun 14, 2005 7:35 pm
by jkj2001
I'm not sure if "fall out" is the correct description, but what I mean is: If I have three indexes on a table, for fields A, B and C, and I update column C for every record, obviously I'll need to recreate the index for C.

But what about indexes A and B? I didn't update their underlying column values, but would the records that had column C updated have fallen out of A and B as well?

when does a record "fall out" of an index?

Posted: Wed Jun 15, 2005 12:15 pm
by jkj2001
These are all metamorph indexes.

Let's assume for argument B & C are varchar fields, while column A is a blob. It sounds like from your description that indexes for A, B and C will all need refreshing if column C is updated?

when does a record "fall out" of an index?

Posted: Fri Jun 17, 2005 10:05 am
by Kai
Yes; since the updated field is a varchar, the entire row might move, which means all Metamorph indexes on the table need updating.

when does a record "fall out" of an index?

Posted: Fri Jun 17, 2005 5:58 pm
by jkj2001
Thanks Kai....er, can I ask a followup? What if instead of updating a number of rows I delete them? Would I be wise to rebuild the metamorph indexes then too, or are they still ok?

when does a record "fall out" of an index?

Posted: Fri Jun 17, 2005 6:17 pm
by Kai
They still need updating if you delete rows. But the performance hit of not updating the index is usually slightly less, as the effort to remove hits from the index result set for those deleted rows is typically less than the effort to linearly scan updated/inserted/changed rows that haven't yet been indexed.

when does a record "fall out" of an index?

Posted: Mon Jun 20, 2005 11:14 am
by mark
Just to be clear. You don't need to drop and rebuild any index. Just update metamorph indices by reissuing the same create index statement used to create it. The other option is to get the monitor (chkind) update it automatically as needed. See also SYSMETAINDEX.

when does a record "fall out" of an index?

Posted: Mon Jun 20, 2005 12:54 pm
by jkj2001
Thanks, guys.

I thought that incremental reindexing (eg issuing the same index commands) eventually led to bloated indexes, much like changing the oil in your car without replacing the filter can hurt your valves eventually.

How often would you reccomend a drop-and-recreate, to keep things nice and fresh? After three incrementals, ten, maybe twenty? Let's assume 5% of our rows will have changed between reindexes.