I am using MySQL as my RDBMS.
But I think it must be applicable to other relational DBs.
I have a table Z, where I have 5 columns: a, b, c, d, e.
Columns a, b, c comprise a composite primary key.
Now, when it comes down to querying in the WHERE clause there will be times when I will be fetching data based on the values of columns a, b, c. But only one column out of 3 will be set.
Do I need to create 3 indices against these columns?
Follow-up question: what if I need to query my table knowing values for 2 columns out of 3? Will the creation of an additional 3 indices help to speed up my queries? (a, b) (a, c) (b, c)
Please advise.