-------------------
| 0 | SELECT STATEMENT | | 3613 | 141K| 28 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| OOO | 3613 | 141K| 28 (0)| 00:00:01 |
-------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("OWNER"='SCOTT')
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
610 bytes sent via SQL*Net to client
524 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
因为这个索引不是唯一索引,where后面的列用到了索引000,所以进行index range scan
SQL> select owner, object_name,object_type from test where object_name='EMP' ;
no rows selected
Execution Plan
----------------------------------------------------------
Plan hash value: 1799988433
-------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 2 | 80 | 26 (0)| 00:00:01 |
|* 1 | INDEX SKIP SCAN | OOO | 2 | 80 | 26 (0)| 00:00:01 |
-------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("OBJECT_NAME"='EMP')
filter("OBJECT_NAME"='EMP')
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
28 consistent gets
0 physical reads
0 redo size
479 bytes sent via SQL*Net to client
513 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
0 rows processed
上面的查询可以通过索引000来得到,并且where后面没有用到索引列,而且返回的行数很少(。)所以cbo选择index skip scan
select owner, object_name,object_type from test where object_type='INDEX';
Execution Plan
----------------------------------------------------------
Plan hash value: 3464522019
-----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1971 | 78840 | 168 (1)| 00:00:03 |
|*