SQL> set autotrace traceonly stat exp
SQL> select count(*) from test;
Execution Plan
----------------------------------------------------------
Plan hash value: 1690092453
------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 10 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | INDEX FAST FULL SCAN| I_TEST | 13540 | 10 (0)| 00:00:01 |
------------------------------------------------------------------------
Statistics
----------------------------------------------------------
138 recursive calls
0 db block gets
52 consistent gets
0 physical reads
0 redo size
413 bytes sent via SQL*Net to client
396 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
1 rows processed
|
SQL> select count(*) from test;
Execution Plan
----------------------------------------------------------
Plan hash value: 1950795681
-------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 49 (3)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | TABLE ACCESS FULL| TEST | 13540 | 49 (3)| 00:00:01 |
-------------------------------------------------------------------
Statistics
----------------------------------------------------------
138 recursive calls
0 db block gets
194 consistent gets
0 physical reads
0 redo size
413 bytes sent via SQL*Net to client
396 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> select object_id from dba_objects where object_name='I_TEST';
OBJECT_ID
----------
65949
查询到索引I_TEST的对象ID 为 65949
SQL> ALTER SESSION SET EVENTS 'immediate trace name TREEDUMP level 65949';
Session altered.
查询到索引I_TEST的对象ID 为 65949,使用tree dump可以看到索引树的结构
branch: 0x40926a 4231786 (0: nrow: 29, level: 1)
leaf: 0x40926b 4231787 (-1: nrow: 485 rrow: 485)
leaf: 0x40926c 4231788 (0: nrow: 479 rrow: 479)
leaf: 0x40926d 4231789 (1: nrow: 478 rrow: 478)
leaf: 0x40926e 4231790 (2: nrow: 479 rrow: 479)
leaf: 0x40926f 4231791 (3: nrow: 479 rrow: 479)
leaf: 0x409270 4231792 (4: nrow: 479 rrow: 479)
leaf: 0x409271 4231793 (5: nrow: 479 rrow: 479)
leaf: 0x409272 4231794 (6: nrow: 478 rrow: 478)
leaf: 0x409273 4231795 (7: nrow: 479 rrow: 479)
leaf: 0x409274 4231796 (8: nrow: 479 rrow: 479)
leaf: 0x409275 4231797 (9: nrow: 479 rrow: 479)
leaf: 0x409276 4231798 (10: nrow: 479 rrow: 479)
leaf: 0x409277 4231799 (11: nrow: 479 rrow: 479)
leaf: 0x409278 4231800 (12: nrow: 479 rrow: 479)
leaf: 0x409279 4231801 (13: nrow: 479 rrow: 479)
leaf: 0x40927a 4231802 (14: nrow: 479 rrow: 479)
leaf: 0x40927b 4231803 (15: nrow: 479 rrow: 479)
leaf: 0x40927c 4231804 (16: nrow: 479 rrow: 479)
leaf: 0x40927d 4231805 (17: nrow: 471 rrow: 471)
leaf: 0x40927e 4231806 (18: nrow: 449 rrow: 449)
leaf: 0x40927f 4231807 (19: nrow: 449 rrow: 449)
leaf: 0x409280 4231808 (20: nrow: 449 rrow: 449)
leaf: 0x409281 4231809 (21: nrow: 449 rrow: 449)
leaf: 0x409282 4231810 (22: nrow: 449 rrow: 449)
leaf: 0x409283 4231811 (23: nrow: 448 rrow: 448)
leaf: 0x409284 4231812 (24: nrow: 448 rrow: 448)
leaf: 0x409285 4231813 (25: nrow: 449 rrow: 449)
leaf: 0x409286 4231814 (26: nrow: 449 rrow: 449)
leaf: 0x409287 4231815 (27: nrow: 404 rrow: 404)
|
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/40239/viewspace-706118/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/40239/viewspace-706118/