Query:
select `r`.`id` as `id`
from `tbl_rls` as `r`
left join `tblc_comment_manager` as `cm` on `cm`.`rlsc_id` != `r`.`id`
Both tabl
You may need to provide more info. But one thing I would try is reversing the order of your ON clause (because it's so easy):
ON r.id != cm.rlsc_id
Edit: and you should put indexes on your PK (id) columns.
But I think this article might help you out.
Basically it says that NOT IN
takes less resources than LEFT JOIN
. A commenter in that article mentions using NOT EXISTS
is best.
Also, I'm not sure this is accurate or not, but this article says that NOT IN does a full table scan, and NOT EXISTS can use an index.