浅谈Oracle索引
SQL> set autot trace exp statSQL> select * from t2 where name='T2';
Execution Plan
----------------------------------------------------------
Plan hash value: 591771271
--------------------------------------------------------------------------------
------
|> |
--------------------------------------------------------------------------------
------
| 0 | SELECT STATEMENT | | 1 | 107 | 4 (0)| 00:0
0:01 |
| 1 |TABLE ACCESS BY INDEX ROWID| T2 | 1 | 107 | 4 (0)| 00:0
0:01 |
|*2 | INDEX RANGE SCAN | IND_T2 | 1 | | 3 (0)| 00:0
0:01 |
--------------------------------------------------------------------------------
------
Predicate Information (identified by operation> ---------------------------------------------------
2 - access("NAME"='T2')
Statistics
----------------------------------------------------------
183recursive calls
0db block gets
28consistent gets
4physical reads
0redo> 875bytes sent via SQL*Net to client
469bytes received via SQL*Net from client
2SQL*Net roundtrips to/from client
5sorts (memory)
0sorts (disk)
1rows processed
SQL> select * from t2 where name='SALE';
292435 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 1513984157
--------------------------------------------------------------------------
|> --------------------------------------------------------------------------
| 0 | SELECT STATEMENT| | 291K| 29M|1391 (2)| 00:00:17 |
|*1 |TABLE ACCESS FULL| T2 | 291K| 29M|1391 (2)| 00:00:17 |
--------------------------------------------------------------------------
Predicate Information (identified by operation> ---------------------------------------------------
1 - filter("NAME"='SALE')
Statistics
----------------------------------------------------------
1recursive calls
0db block gets
25293consistent gets
605physical reads
0redo> 30733266bytes sent via SQL*Net to client
214914bytes received via SQL*Net from client
19497SQL*Net roundtrips to/from client
0sorts (memory)
0sorts (disk)
292435rows processed
SQL> select /*+index(t2 ind_t2)*/ * from t2 where name='SALE';
292435 rows selected.
Execution Plan
----------------------------------------------------------
Plan hash value: 591771271
--------------------------------------------------------------------------------
------
|> |
--------------------------------------------------------------------------------
------
| 0 | SELECT STATEMENT | | 291K| 29M|6850 (1)| 00:0
1:23 |
| 1 |TABLE ACCESS BY INDEX ROWID| T2 | 291K| 29M|6850 (1)| 00:0
1:23 |
|*2 | INDEX RANGE SCAN | IND_T2 | 292K| | 662 (2)| 00:0
0:08 |
--------------------------------------------------------------------------------
------
Predicate Information (identified by operation> ---------------------------------------------------
2 - access("NAME"='SALE')
Statistics
----------------------------------------------------------
1recursive calls
0db block gets
45391consistent gets
2454physical reads
0redo> 36955099bytes sent via SQL*Net to client
214914bytes received via SQL*Net from client
19497SQL*Net roundtrips to/from client
0sorts (memory)
0sorts (disk)
292435rows processed
页:
[1]