I have the following query:
SELECT table_1.id
FROM
table_1
LEFT JOIN table_2 ON (table_1.id = table_2.id)
WHERE
table_1.col_condition_1 = 0
AND table_1.col
OR
is a performance killer.UNION
instead of OR
can speed up the query.LIMIT
without ORDER BY
is dubious.id_UNIQUE
.INDEX(a)
is unnecessary when you also have INDEX(a,b)
.IN (1, 2)
might be faster than NOT IN (3, 4)
.