Re: Index problems on v7.1
Posted in 1996
Order by takes precident over Where clause. Create Index with ORDER by columns. This index could also be clustered (be sure to read/understand how clustered index operate) and you could lose order by completely. ------------------------------------------------------------------------- Cheryl Kendricks Internet:cherylk@prod1.jcdc.doleta.gov OR cherylk@gwysmtp.jcdc.doleta.gov DTSI, Inc. Voice: 1-800-598-5008 Fax: 512-393-7296 Database Administrator - DOL Job Corps San Marcos, Texas ------------------------------------------------------------------------ On Thu, 30 May 1996 Norrgren@aol.com wrote: } Dear All, } } I seem to have a slight problem in forcing a SELECT down a specific index } when doing a "between" on a column ( where col_name > x and col_name < y ). } } I am selecting all items listed in the index and also doing an ORDER BY } exactly as the index is, as this normally seems to do the trick. } } It seems now as if the engine is doing a sequential scan in to a temporary } table in the } order required rather than using the index, as this query is very much slower } than a direct where col_name = x. (700K rows in the table). } } Any suggestions ? } } Regards } } -pern }