33.5. Watch the IN Predicate
The IN predicate is really shorthand for a series of ORed equality tests. There are two forms: either an explicit list of values is given, or a subquery is used to make such a list of values.
The database engine has no statistics about the relative frequency of the values in a list of constants, so it will assume that the list is in the order in which the values are to be used. People like to order lists alphabetically or by magnitude, but it would be better to order the list from most frequently occurring values to least frequently occurring. It is also pointless to have duplicate values in the constant list, since the predicate will return TRUE if it matches the first duplicate it finds and will never get to the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access