Is there any performance benefit if order of where clause criteria changes ?
what i mean is eg
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 .
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.