Replaced 'WHERE NOT EXISTS' with 'LEFT JOIN ... IS NULL' for improved performance