I would like to clarify, if not in use in the request, it will not bring harm? Just here I somehow asked something similar and I was told that NOT IN would slow down.

If you use it normally, then fine. If not, tell me the replacement.

    1 answer 1

    You can try through " EXISTS ". In general, IMHO "NOT IN" should not slow down ...

    UPD # 1: EXISTS returns TRUE if the subquery returns at least one row, and FALSE - if the subquery does not return any rows.

    In your case, the request will be:

    SELECT tid FROM tasks WHERE EXISTS(SELECT 1 FROM tasks_done WHERE id = tid) 

    UPD # 2: here's a working example

    • @ Rams666, and how to use exists? I get a syntax error: >> SELECT tid FROM tasks WHERE tid EXISTS (SELECT id FROM tasks_done ) - ModaL
    • @ Rams666, very strange. But stupid emptiness, even this does not produce anything: >> SELECT tasks.tid FROM tasks WHERE EXISTS (SELECT tdtid FROM tasks_done ) - ModaL