Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
5 consistent gets
0 physical reads
0 redo size
609 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)
8 rows processed
对于唯一索引,发生index range scan的时候就是返回多行记录,where后面有<,>,between..and 等返回扫描
SQL> select owner from test where owner='SCOTT';
Execution Plan
----------------------------------------------------------
Plan hash value: 2280863269
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 3613 | 21678 | 9 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| IND_OWNER | 3613 | 21678 | 9 (0)| 00:00:01 |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("OWNER"='SCOTT')
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
3 consistent gets
0 physical reads
0 redo size
526 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后面是=条件,但也可能返回多行,也是index range scan扫描
SQL> select object_name,object_type from test where owner='SCOTT';
Execution Plan
----------------------------------------------------------
Plan hash value: 2845720098
-------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------
| 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')