WHERE id IN(4)与WHERE id = 4有何不同?

时间:2012-08-22 20:16:11

标签: mysql sql query-optimization

  

可能重复:
  Why would an IN condition be slower than “=” in sql?

执行之间是否有任何性能差异:

SELECT foo FROM bar WHERE id IN (4)

对战

SELECT foo FROM bar WHERE id = 4

1 个答案:

答案 0 :(得分:0)

我相信MySQL优化器会将id IN(4)转换为id = 4,因此没有性能差异