Performance differences between IN and EXISTS
Posted: | Categories: Database, Oracle, Programming | Tags: EXISTS, IN, Optimization, Performance
Very often I hear people wondering if it’s better the EXISTS
or the IN
operator.
Let’s start by saying that the two operators behave differently when NULL
values are involved
(see this post).
If you are sure that the field used to join the tables does not include NULL
values then the IN
operator “generally”
performs better than EXISTS
. I say “generally” because this is not always the case. For example consider the following query: