I've found posts of = vs IN for single value (link and link), but I'm asking actually for multiple values. Which is likely to perform better:
# Query 1:
SELECT * FROM tbl WHERE id = 50 OR id = 51 OR id = 52
# Query 2:
SELECT * FROM tbl WHERE id IN (50, 51, 52)
# Query 3:
SELECT * FROM tbl WHERE id >= 50 AND id <= 52
Note: id is primary and indexed, obviously.
WHERE id BETWEEN 50 AND 52– Lennart - Slava Ukraini May 19 '18 at 05:55Q1andQ2are eqs.Q3andQ by Lennartare eqs. But this pairs of queries are NOT equivalent formally (for example, nothing in the text above preventidto be floating-point number). – Akina May 19 '18 at 18:22INturns intoOR, nor vice versa: See here – Rick James May 30 '18 at 21:34