apache > db
Apache DB Project
 
Font size:      

Static IN Predicate Transformations

Static IN Predicate Transformations

A static IN list predicate is one in which the IN list is composed entirely of constants. Derby calculates the minimum and maximum values in the list and transforms the predicate into three new predicates: the original IN predicate, one that uses the >= operator, and one that uses the <= operator. The second and third are optimizable. For example:

orig_airport IN ('ABQ', 'AKL', 'DSM')

is transformed into

orig_airport IN ('ABQ', 'AKL', 'DSM')
AND orig_airport >= 'ABQ'
AND orig_airport <= 'DSM'

NOT IN Predicate Transformations

NOT IN lists are transformed into multiple predicates that use the <> operator. <> predicates are not optimizable, but they are sargable. For example:

orig_airport NOT IN ('ABQ', 'AKL', 'DSM')

becomes

orig_airport <> 'ABQ'
AND orig_airport <> 'AKL'
AND orig_airport <> 'DSM'

In addition, large lists are sorted in ascending order for performance reasons.


Previous Page
Next Page
Table of Contents
Index