Index usage [message #387679] |
Fri, 20 February 2009 04:56 |
deepak samal
Messages: 29 Registered: February 2005
|
Junior Member |
|
|
Hi
I have a query like select * from t1 where col1 = 1 and col2 between 1 and 9999.
I have an unique index on T1(col1, col2). But as i am using 'BETWEEN' in my query, my index is not using the col2. It is going for 1 column hit.
instead of 'BETWEEN' i also tried with <= and >= as (select * from t1 where col1 >= 1 and col2 <= 9999) but this also does not help out. Still this is a single column hit. Col2 is not used in my index.
Is there any alternate for 'BETWEEN' clause. How can i improve the performance of this query? How can i best use my index?
Thanks
Deepak
[Updated on: Fri, 20 February 2009 05:03] Report message to a moderator
|
|
|
|
|