Reputation: 1899
Is there a performance difference between the two queries below?
SELECT * FROM mytable WHERE name IN ('ABC');
SELECT * FROM mytable WHERE name = ('ABC');
Upvotes: 2
Views: 74
Reputation: 29091
no there is no difference between IN
and =
for single value. you can check query execution plan using EXPLAIN EXTENDED:
EXPLAIN EXTENDED SELECT * FROM mytable WHERE name IN ('ABC');
SHOW WARNINGS;
Upvotes: 4
Reputation: 12488
No. I believe MySQL rewrites x IN (a, b, c)
to x = a OR x = b OR x = c
internally, so it's the same query.
Upvotes: -1