Keywords: Predicates, directly optimizable, Matching index scans, definition, Optimizable, Optimization, requirements for, Optimizable operators

# Directly optimizable predicates

Some predicates provide clear-cut starting and stopping points. A predicate provides start or stop conditions, and is therefore optimizable, when:

- It uses a simple column reference to a column (the name of the column, not the name of the column within an expression or method call). For example, the following is a simple column reference:

      WHERE orig_airport = 'SFO'

  The following is not:

      WHERE lower(orig_airport) = 'sfo'

- It refers to a column that is the first or only column in the index.

  References to contiguous columns in other predicates in the statement when there is a multi-column index can further define the starting or stopping points. (If the columns are not contiguous with the first column, they are not optimizable predicates but can be used as qualifiers.) For example, given a composite index on FlightAvailability (flight_id, segment_number, and flight_date), the following predicate satisfies that condition:

      WHERE flight_id = 'AA1200' AND segment_number = 2

  The following one does not:

      WHERE flight_id = 'AA1200' AND flight_date = CURRENT_DATE

- The column is compared to a constant or to an expression that does not include columns in the same table. Examples of valid expressions: other_table.column_a, ? (dynamic parameter), 7+9. The comparison must use the following operators:
  - =
  - <
  - <=
  - >
  - >=
  - IS NULL

Parent topic: What's optimizable?
Related concepts
Indirectly optimizable predicates
Joins