0

Possible Duplicate:
Why would an IN condition be slower than “=” in sql?

Is there any performance difference between doing:

SELECT foo FROM bar WHERE id IN (4)

Versus

SELECT foo FROM bar WHERE id = 4
Community
  • 1
  • 1
Ali
  • 261,656
  • 265
  • 575
  • 769
  • 4
    did you try `explain select ...`? – juergen d Aug 22 '12 at 20:18
  • That question is talking about using an IN statment in a subquery, e.g `SELECT FROM foo WHERE id IN (SELECT..)` whereas my question is the diff. between `SELECT WHERE id IN (val)` vs `SELECT WHERE id = val`. Hence its not a duplicate. – Ali Aug 22 '12 at 20:30

1 Answers1

0

I believe the MySQL optimizer will convert the id IN(4) to id = 4, so no performance difference

user387049
  • 6,647
  • 8
  • 53
  • 55