Subject | Re: My query plan does not use correct index |
---|---|
Author | reynaldi81 |
Post date | 2011-08-19T14:45:53Z |
@Ann Harrison: Thanks for the detail explanation. so i guess i have the indexes correct.
@svein_erling: actually i'm trying to retrieve only one index. I forgot to put "first 1" on my first post.
I have done some more checking and found out that because i use join, the query wont use the descending index.
I did more testing and try these queries
"select col1 from table1 where col2=1 and col3=1 and col4=1 and col5=1"
and
"select col1 from table1 where col2>1 and col3>1 and col4=1 and col5=1"
index1 (col2, col3, col4, col5)
index2 (col4, col5)
query no 1 uses index no 1
and query no 2 uses index no 2.
Can you guys tell me what happen?
@svein_erling: actually i'm trying to retrieve only one index. I forgot to put "first 1" on my first post.
I have done some more checking and found out that because i use join, the query wont use the descending index.
I did more testing and try these queries
"select col1 from table1 where col2=1 and col3=1 and col4=1 and col5=1"
and
"select col1 from table1 where col2>1 and col3>1 and col4=1 and col5=1"
index1 (col2, col3, col4, col5)
index2 (col4, col5)
query no 1 uses index no 1
and query no 2 uses index no 2.
Can you guys tell me what happen?