A predicate is an element of a search condition that expresses or implies a comparison operation. Predicates, which usually appear in the WHERE clause of a query, are used to reduce the scope of the result set that is returned by the query.
Characteristic | Predicate Type | |||
---|---|---|---|---|
Range-delimiting | Index-SARGable | Data-SARGable | Residual | |
Reduce index I/O | Yes | No | No | No |
Reduce data page I/O | Yes | Yes | No | No |
Reduce the number of rows that are passed internally | Yes | Yes | Yes | No |
Reduce the number of qualifying rows | Yes | Yes | Yes | Yes |
INDEX IX1: NAME ASC,
DEPT ASC,
MGR DESC,
SALARY DESC,
YEARS ASC
where
name = :hv1 and
dept = :hv2 and
years > :hv5
The first two predicates (name
= :hv1 and dept = :hv2) are range-delimiting predicates,
and years > :hv5 is an index-SARGable predicate.The optimizer uses index data instead of reading the base table when it evaluates these predicates. Index-SARGable predicates reduce the number of rows that need to be read from the table, but they do not affect the number of index pages that are accessed.
Predicates that cannot be evaluated by the index manager, but that can be evaluated by Data Management Services (DMS), are called data-SARGable predicates. These predicates usually require access to individual rows in a table. If required, DMS retrieves the columns that are needed to evaluate a predicate, as well as any other columns that are needed for the SELECT list, but that could not be obtained from the index.
INDEX IX0: PROJNO ASC
select projno, projname, respemp
from project
where deptno = 'D11'
order by projno
Some predicates that are applied only to an index must be reapplied when the data page is accessed. For example, access plans that use index ORing or index ANDing always reapply the predicates as residual predicates when the data page is accessed.