Sub topic 10
Access and Filter Predicates in an Oracle Execution Plan
This chapter assumes that you know basic SELECT, WHERE, and ORDER BY syntax, and that you can run Oracle statements in SQL*Plus, SQL Developer, or a similar client. It also assumes that you understand the purpose of an index.
An execution plan shows how Oracle intends to find and return rows. Two important terms in a plan are access predicate and filter predicate:
- An access predicate helps Oracle locate rows in an index or table operation.
- A filter predicate removes rows after Oracle has located or produced them.
An access predicate usually reduces the amount of data Oracle must read. A filter predicate can still be useful, but it may require Oracle to inspect rows that do not match the final condition.
Example: access and filter predicates
Suppose orders has a composite index on (customer_id, order_date):
CREATE INDEX orders_customer_date_ix
ON orders (customer_id, order_date);
EXPLAIN PLAN FOR
SELECT order_id, order_date, status
FROM orders
WHERE customer_id = 42
AND order_date >= DATE '2026-01-01'
AND order_date < DATE '2026-02-01'
AND status = 'OPEN';
SELECT *
FROM TABLE(DBMS_XPLAN.DISPLAY);The plan might contain output like this:
| Id | Operation | Name |
| 1 | TABLE ACCESS BY INDEX ROWID | ORDERS |
|* 2 | INDEX RANGE SCAN | ORDERS_CUSTOMER_DATE_IX |The predicate section could look like this:
Predicate Information:
----------------------
2 - access("CUSTOMER_ID"=42
AND "ORDER_DATE">=DATE '2026-01-01'
AND "ORDER_DATE"<DATE '2026-02-01')
1 - filter("STATUS"='OPEN')The index range scan uses customer_id and the date range as access predicates. Oracle can navigate directly to the relevant part of the index.
The status condition is a filter predicate because status is not part of this index. Oracle first finds the rows for customer 42 in January, visits the table rows, and then checks whether each row has status OPEN.
Why the distinction matters
A predicate can be logically correct but still expensive if it filters many rows late in the plan. For example, an index may locate 100,000 rows using an access predicate, while a filter predicate reduces them to 10 rows. Oracle still had to read and inspect a large candidate set.
An index containing (customer_id, order_date, status) might allow more conditions to become access predicates. However, adding columns increases index size and the work required for inserts, updates, and deletes. Use the execution plan and actual workload to decide whether the change is worthwhile.
The plan also shows estimated row counts. A large difference between estimated and actual rows can lead Oracle to choose a poor access path. When possible, inspect an executed cursor with runtime statistics:
SELECT /*+ gather_plan_statistics */
order_id, order_date, status
FROM orders
WHERE customer_id = 42
AND order_date >= DATE '2026-01-01'
AND order_date < DATE '2026-02-01'
AND status = 'OPEN';
SELECT *
FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALLSTATS LAST'));Look at E-Rows for estimated rows and A-Rows for actual rows. Large differences suggest stale statistics, skewed data, or a predicate whose selectivity Oracle estimated incorrectly.
Exercise
In the example plan, why is STATUS a filter predicate instead of an access predicate?
Show answer
The index contains CUSTOMERID and ORDERDATE but not STATUS. Oracle uses the index to find candidate rows, visits those rows, and then checks STATUS.