access and filter,accessfilter
access:表示這個謂詞條件的值將會影響資料的訪問路徑(表還是索引)。
filter:表示謂詞條件的值並不會影響資料訪問路徑,只起到過濾的作用。
----建立一張表echo----SQL> create table echo as select * from dba_objects;Table created.SQL> set autotrace trace exp;SQL> set linesize 150;SQL> select * from echo where object_id=1000;Execution Plan----------------------------------------------------------Plan hash value: 642657756--------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |--------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 12 | 2484 | 289 (1)| 00:00:04 ||* 1 | TABLE ACCESS FULL| ECHO | 12 | 2484 | 289 (1)| 00:00:04 |--------------------------------------------------------------------------Predicate Information (identified by operation id):--------------------------------------------------- 1 - filter("OBJECT_ID"=1000) ----因為表echo沒有建立索引,執行計畫沒有選擇資料訪問路徑的餘地,謂詞條件在這裡只是起到資料過濾的作用,所以使用了filter。Note----- - dynamic sampling used for this statement (level=2) ----建立索引的情況----SQL> create index echo_ind on echo(object_id);Index created.SQL> select * from echo where object_id=1000;Execution Plan----------------------------------------------------------Plan hash value: 1345159126----------------------------------------------------------------------------------------| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |----------------------------------------------------------------------------------------| 0 | SELECT STATEMENT | | 1 | 207 | 2 (0)| 00:00:01 || 1 | TABLE ACCESS BY INDEX ROWID| ECHO | 1 | 207 | 2 (0)| 00:00:01 ||* 2 | INDEX RANGE SCAN | ECHO_IND | 1 | | 1 (0)| 00:00:01 |----------------------------------------------------------------------------------------Predicate Information (identified by operation id):--------------------------------------------------- 2 - access("OBJECT_ID"=1000) ----謂詞條件影響到資料訪問的路徑,選擇了索引,所以用access。Note----- - dynamic sampling used for this statement (level=2)
以上