Why this mysql query (with is null check) is so slower than this other one?
问题 I getting in doubt with "IS NULL" MySQL check. I have this 2 queries. The first one runs in about 300 seconds. The second one run less then 1 second! Slow query: SELECT count(distinct(u.id)) FROM ips_usuario AS u JOIN ips_fatura AS f ON ((u.id = f.ips_usuario_id) OR (u.ips_usuario_id_titular IS NOT NULL AND u.ips_usuario_id_titular = f.ips_usuario_id)); Fast query: SELECT count(distinct(u.id)) FROM ips_usuario AS u JOIN ips_fatura AS f ON ((u.id = f.ips_usuario_id) OR (u.ips_usuario_id