I’m working with a PostgreSQL database and am experiencing performance issues with a query that includes a check for NULL values. The query execution time is significantly high, and I suspect that the IS NULL condition might be a major factor in this issue.
SELECT cp_contact.id AS id
FROM cp_contact LEFT JOIN cp_contactrep ON cp_contact.id = cp_contactrep.contact_id WHERE cp_contact.company_id = 13214 AND cp_contactrep.user_id is NUll or cp_contactrep.user_id IN (20373, 20818) LIMIT 50