Reputation:
Is there any performance benefit if order of where clause criteria changes ?
what i mean is e.g.
i have a select query,
SELECT * from mytable WHERE enabled = '1' AND type = 'pictures' AND category = 'family'
now in above query
so my question is will i see any perfomance benefit if i order the where clause like this
SELECT * from mytable WHERE category = 'family' AND type = 'pictures' AND enabled = '1'
Thanks using : MYISAM as table engine. and all the columns in where clause has index .
Upvotes: 0
Views: 84
Reputation: 13110
Nah, the optimizer is clever enough to use the best index in this simple SELECT
.. use an EXPLAIN
on each to double check if you like (they should come out the same).
You may get better performance if you add one INDEX on all three columns however.
Upvotes: 2