Reputation: 7413
Suppose there are two indexes on a table
Please tell me, whether in below case index will help?
.. where col1,col4
.. where col3,col4
.. where col1,col3
.. where col1,col2,col3,col4
*note,
Upvotes: 2
Views: 189
Reputation: 55489
The columns mentioned in where clause, if indexed, then those indexes will be used. For eg:- in your "Where col1, col4", col1 is indexed and hence it will be used. Similarly for other conditions. For columns which both indexes are available, then both of them might be used. For eg:- in your 3rd and 4th where clauses.
Upvotes: 0
Reputation: 838216
where col1,col4
- can use prefix col1
from index 1.where col3,col4
- can use index 2.where col1,col3
- can use either index2 or prefix col1
from index 1.where col1,col2,col3,col4
- can use either indexUpvotes: 2