Distinguishing Access and Filter-Predicates
The Oracle database uses three different methods to applywhere clauses (predicates):
- Access predicate (“access”)
The access predicates express the start and stop conditions of the leaf node traversal.
- Index filter predicate (“filter” for index operations)
Index filter predicates are applied during the leaf node traversal only. They do not contribute to the start and stop conditions and do not narrow the scanned range.
- Table level filter predicate (“filter” for table operations)
Predicates on columns that are not part of the index are evaluated on table level. For that to happen, the database must load the row from the table first.
Note
Index filter predicates give a false sense of safety; even though an index is used, the performance degrades rapidly on a growing data volume or system load.
Execution plans that were created using the DBMS_XPLAN
utility (see “Getting an Execution Plan”), show the index usage in the “Predicate Information” section below the tabular execution plan:
------------------------------------------------------ | Id | Operation | Name | Rows | Cost | ------------------------------------------------------ | 0 | SELECT STATEMENT | | 1 | 1445 | | 1 | SORT AGGREGATE | | 1 | | |* 2 | INDEX RANGE SCAN| SCALE_SLOW | 4485 | 1445 | ------------------------------------------------------ Predicate Information (identified by operation id): 2 - access("SECTION"=:A AND "ID2"=:B) filter("ID2"=:B)
The numbering of the predicate information refers to the “Id” column of the execution plan. There, the database also shows an asterisk to mark operations that have predicate information.
This example, taken from the chapter “Performance and Scalability”, shows anINDEX RANGE SCAN
that has access and filter predicates. The Oracle database has the peculiarity of also showing some filter predicate as access predicates—e.g., ID2=:B
in the execution plan above.
Important
If a condition shows up as filter predicate, it is a filter predicate—it does not matter if it is also shown as access predicate.
This means that the INDEX RANGE SCAN
scans the entire range for the condition"SECTION"=:A
and applies the filter "ID2"=:B
on each row.
Filter predicates on table level are shown for the respective table access such asTABLE ACCESS BY INDEX ROWID
or TABLE ACCESS FULL
.
Figure A.1. Access and Filter Predicates in Oracle SQL Developer
Links
Chapter 3, “Performance and Scalability”, demonstrates the performance difference access and index filter predicates make.
출처 : http://use-the-index-luke.com/sql/explain-plan/oracle/filter-predicates
'Oracle > DBA' 카테고리의 다른 글
[Oracle] Merge 구문 1 (0) | 2015.11.12 |
---|---|
[펌] [ORACLE] SYS_CONTEXT 및 USERENV 정리 (0) | 2015.09.03 |
특정 컬럼만 Masking (0) | 2015.09.03 |
[펌] DBMS_XPLAN (0) | 2015.08.28 |
DBMS_RANDOM (0) | 2015.08.18 |