Try to use exists and not exists instead of IN and Not in, don't lazy, try not to use Select * from ...., and write the field name SELECT FIELD1, FIELD2, ....