The assertion that exists is more efficient than in is inaccurate.
If the two table size of the query is equal, then the in and exists are not very different.
If one of the two tables is smaller and one is a large table, then the subquery table is large with exists, and the subquery table is small in:
Example: Table A (small table), table B (large table)
1:
SELECT * from A where CC in (select CC from B)
Inefficient, using the index of the CC column on table A;
SELECT * from A where exists (select cc from B where cc=a.cc)
High efficiency, using the index of the CC column on the B table.
The opposite
2:
SELECT * from B where cc on (select cc from A)
High efficiency, using the index of CC column on B table;
SELECT * from B where exists (select cc from A where cc=b.cc)
Inefficient, using the index of the CC column on table A.
Not in and not exists
If the query statement uses not in so the appearance of the full table scan, not used index;
The index on the table can still be used by the subquery of not extsts.
So no matter the table is large, using not exists is faster than not.
SQL two-table connection