From: Ann W. H. <aha...@ib...> - 2005-06-03 16:34:00
|
Jim Starkey wrote: >>>> > > Excuse me, but I don't understand who said that indexes should not be > used for inequalities or why he or she would say that. Unless 100% of > the records meet the selection critereon, the indexed version will > always be faster, and even if 100% of the records are selected, the cost > of the index scan is small compared to fetching the actual records. Am > I missing something here? > Yes... the process of building the data for the query, includes this step: 4) Simulate some past table activity (important! do not skip this step) update mytable set status = 3 where status = 1; update mytable set status = 1 where status = 2; update mytable set status = 2 where status = 3; commit; Those updates create back versions and index entries. The result is that every record has a version that has the value 1. Most of them are old versions and the garbage collection may also affect the query timings. Regards, Ann |