Suppose there are two indexes on a table
- index1 on col1,col2
- index2 on col3
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,
- i wrote where clause only without specifying the conditions. Only used column are mentioned
- I am using DB2. So as per my knowledge column sequence would not matter.
- col4 is not having any index.
where col1,col4– can use prefixcol1from index 1.where col3,col4– can use index 2.where col1,col3– can use either index2 or prefixcol1from index 1.where col1,col2,col3,col4– can use either index