|
|
Archives of the TeradataForum
Message Posted: Sat, 15 Dec 2001 @ 12:59:48 GMT
Subj: | | Re: Exists/Not Exists versus IN/Not IN |
|
From: | | Dieter N�th |
| Which is usually faster, using exists/not exists or in/not. And in general why. | |
There's almost no difference in Teradata between IN and EXISTS, just EXPLAIN both, it's the same plan.
EXISTS/NOT EXISTS will produce the same plan, the only difference is the join type: Inclusion vs. exclusion.
IN/NOT IN will produce totally different plans, if the joined columns are NULLable, because the optimizer has to consider the three-way
logic of NOT IN.
So in most cases it's better to use NOT EXISTS, especially because you don't have to think about NULLs.
Dieter
| |