Possible Duplicate:
Does the order of fields in a WHERE clause affect performance in MySQL?
Does the order of the elements in a WHERE clause change the speed of the query?
I have the following:
SELECT * FROM table1 WHERE a<b
. This returns 500 records.
SELECT * FROM table1 WHERE c<d
. This returns 130000000 records.
Now, if you have a choice between:
SELECT * FROM table1 WHERE a<b AND c<d
or
SELECT * FROM table1 WHERE c<d AND a<b
Which of these 2 queries will be faster? Does the order matter?