l1t@tom.com writes:
> I think the id columns of table a and b are not null, so the query of "not in" and "not exists" are equal,they
shoulduse similar plans.
NOT IN and NOT EXISTS are *not* equivalent. Per SQL standard, NOT IN
has different (and usually not very desirable) behavior with NULL
values. The spec-mandated behavior makes it a lot harder to optimize
nicely --- and since you usually don't want what it does anyway, we
haven't tried hard.
regards, tom lane