I've been reading, that MySQL has a problem with queries that use IN() statement - sometimes indexes can't be used. Is that really so, if I don't use a subquery?
Which approach is better? Is there a performance difference?
1
SELECT *
FORM `somewhere`
WHERE
`id` = 3
OR `id` = 5
OR `id` = 15
OR `id` = 56
OR `id` = 34
OR `id` = 47
2
SELECT *
FORM `somewhere`
WHERE
`id` IN (3,5,15,56,34,47)
Copyright Notice:Content Author:「Silver Light」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/4286403/mysql-query-optimization-in-vs-or