I have a question about optimizing sql queries with multiple index.
Imagine I have a table "TEST" with fields "A, B, C, D, E, F".
In my code (php), I use the following "WHERE" query :
- Select (..) from TEST WHERE a = 'x' and B = 'y'
- Select (..) from TEST WHERE a = 'x' and B = 'y' and F = 'z'
- Select (..) from TEST WHERE a = 'x' and B = 'y' and (D = 'w' or F = 'z')
what is the best approach to get the best speed when running queries?
3 multiple Index like (A, B), (A, B, F) and (A, B, D, F)? Or A single multiple index (A, B, D, F)?
I would tend to say that the 3 index would be best even if the space of index in the database will be larger. In my problem, I search the best execution time not the space. The database being of a reasonable size.