Re: Select Performance Using Order By on Index
Posted in 1995
: : SELECT * FROM find WHERE : : find_field1 = 1 AND find_field2 = 5 AND find_field3 >= 1 OR : : find_field1 = 1 AND find_field2 > 5 OR : : find_field1 > 1 : : ORDER BY find_field1, find_field2, find_field3 vs. : : SELECT * FROM find WHERE : : find_field1 >= AND find_field2 >= 5 AND find_field3 >= 1 : : ORDER BY find_field1, find_field2, find_field3 Your second query is not equivalent to the first, and the results you get back are not "incorrect". I think what you want is to treat the entire index as a single field and search forward from a starting point. You could create a separate column made up of a concatenation of the 3 columns (depending on what type they are) and index that column, although I think the previous post suggesting using a UNION is probably the best. Don't know how the performance will be, though. June ---- June Tong Informix Software ---- ---- Senior Consultant (415) 926-6140 ---- ---- International Support junet@informix.com ---- ---- Location-du-jour: Beijing ----