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 |
|* 1 | INDEX FAST FULL SCAN| OOO | 1971 | 78840 | 168 (1)| 00:00:03 |
-----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("OBJECT_TYPE"='INDEX')
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
957 consistent gets
0 physical reads
0 redo size
199834 bytes sent via SQL*Net to client
4253 bytes received via SQL*Net from client
341 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
5088 rows processed
同上,但是这里返回行数较多,cbo选择了index fast full scan,避免了全表扫描