There is a rule of thumb for database multicolumn index that says "put the most selective column first in the index definition". Usually it will give better performance.
But, did the ordering of WHERE clause conditions have performance impact to the query on a table with multicolumn index? Consider this scenario:
Table BID has columns USERID, ITEMID, DATE. Assuming USERID has highest selectivity and DATE has lowest selectivity. The following multicolumn index was created IDX_BID(USERID, ITEMID, DATE).
Does the following two SQL statements have a difference in their performance?
1. SELECT * FROM BID WHERE USERID=? AND ITEMID=? AND DATE=?
2. SELECT * FROM BID WHERE DATE=? AND ITEMID=? AND USERID=?
