Does the order of fields in a WHERE clause affect performance in MySQL?

Viewed 37444

I have two indexed fields in a table - type and userid (individual indexes, not a composite).

types field values are very limited (let's say it is only 0 or 1), so 50% of table records have the same type. userid values, on the other hand, come from a much larger set, so the amount of records with the same userid is small.

Will any of these queries run faster than the other:

select * from table where type=1 and userid=5
select * from table where userid=5 and type=1

Also if both fields were not indexed, would it change the behavior?

3 Answers
Related