- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
7#
发表于 2013-1-22 21:50:44
wshxgxiaoli 发表于 2013-1-22 15:39
多谢!
我自己测了一把
- SQL> create table mactab as select * from dba_tables ;
- Table created.
- SQL> desc mactab;
- Name Null? Type
- ----------------------------------------- -------- ----------------------------
- OWNER NOT NULL VARCHAR2(128)
- TABLE_NAME NOT NULL VARCHAR2(128)
- TABLESPACE_NAME VARCHAR2(30)
- CLUSTER_NAME VARCHAR2(128)
- IOT_NAME VARCHAR2(128)
- STATUS VARCHAR2(8)
- PCT_FREE NUMBER
- PCT_USED NUMBER
- INI_TRANS NUMBER
- MAX_TRANS NUMBER
- INITIAL_EXTENT NUMBER
- NEXT_EXTENT NUMBER
- MIN_EXTENTS NUMBER
- MAX_EXTENTS NUMBER
- PCT_INCREASE NUMBER
- FREELISTS NUMBER
- FREELIST_GROUPS NUMBER
- LOGGING VARCHAR2(3)
- BACKED_UP VARCHAR2(1)
- NUM_ROWS NUMBER
- BLOCKS NUMBER
- EMPTY_BLOCKS NUMBER
- AVG_SPACE NUMBER
- CHAIN_CNT NUMBER
- AVG_ROW_LEN NUMBER
- AVG_SPACE_FREELIST_BLOCKS NUMBER
- NUM_FREELIST_BLOCKS NUMBER
- DEGREE VARCHAR2(40)
- INSTANCES VARCHAR2(40)
- CACHE VARCHAR2(20)
- TABLE_LOCK VARCHAR2(8)
- SAMPLE_SIZE NUMBER
- LAST_ANALYZED DATE
- PARTITIONED VARCHAR2(3)
- IOT_TYPE VARCHAR2(12)
- TEMPORARY VARCHAR2(1)
- SECONDARY VARCHAR2(1)
- NESTED VARCHAR2(3)
- BUFFER_POOL VARCHAR2(7)
- FLASH_CACHE VARCHAR2(7)
- CELL_FLASH_CACHE VARCHAR2(7)
- ROW_MOVEMENT VARCHAR2(8)
- GLOBAL_STATS VARCHAR2(3)
- USER_STATS VARCHAR2(3)
- DURATION VARCHAR2(15)
- SKIP_CORRUPT VARCHAR2(8)
- MONITORING VARCHAR2(3)
- CLUSTER_OWNER VARCHAR2(128)
- DEPENDENCIES VARCHAR2(8)
- COMPRESSION VARCHAR2(8)
- COMPRESS_FOR VARCHAR2(30)
- DROPPED VARCHAR2(3)
- READ_ONLY VARCHAR2(3)
- SEGMENT_CREATED VARCHAR2(3)
- RESULT_CACHE VARCHAR2(7)
- CLUSTERING VARCHAR2(3)
- ACTIVITY_TRACKING VARCHAR2(23)
- DML_TIMESTAMP VARCHAR2(25)
- HAS_IDENTITY VARCHAR2(3)
- CONTAINER_DATA VARCHAR2(3)
- SQL> create index mac_ind on mactab(table_name);
- Index created.
- SQL> alter system flush buffer_cache;
- System altered.
- SQL> /
- System altered.
- SQL> set autotrace traceonly;
- SQL>
- SQL> select count(table_name) from mactab;
- Execution Plan
- ----------------------------------------------------------
- Plan hash value: 196216451
- -------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Cost (%CPU)| Time |
- -------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 1 | 5 (0)| 00:00:01 |
- | 1 | SORT AGGREGATE | | 1 | | |
- | 2 | INDEX FAST FULL SCAN| MAC_IND | 2607 | 5 (0)| 00:00:01 |
- -------------------------------------------------------------------------
- Statistics
- ----------------------------------------------------------
- 6 recursive calls
- 0 db block gets
- 91 consistent gets
- 96 physical reads
- 0 redo size
- 552 bytes sent via SQL*Net to client
- 543 bytes received via SQL*Net from client
- 2 SQL*Net roundtrips to/from client
- 0 sorts (memory)
- 0 sorts (disk)
- 1 rows processed
-
-
- SQL> select distinct sid from v$mystat;
- SID
- ----------
- 64
-
-
-
- SQL> alter session set events '10046 trace name context forever,level 12';
- Session altered.
- SQL> select count(table_name) from mactab;
- COUNT(TABLE_NAME)
- -----------------
- 2483
-
- PARSING IN CURSOR #139831777068160 len=36 dep=0 uid=0 oct=3 lid=0 tim=1358862208006118 hv=3733191424 ad='7c698438' sqlid='9mrhn5bg87ys0'
- select count(table_name) from mactab
- END OF STMT
- PARSE #139831777068160:c=1000,e=1321,p=5,cr=8,cu=0,mis=0,r=0,dep=0,og=1,plh=196216451,tim=1358862208006113
- EXEC #139831777068160:c=0,e=66,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=196216451,tim=1358862208006238
- WAIT #139831777068160: nam='SQL*Net message to client' ela= 5 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1358862208006348
- WAIT #139831777068160: nam='db file sequential read' ela= 15 file#=1 block#=100888 blocks=1 obj#=90849 tim=1358862208006472
- WAIT #139831777068160: nam='db file scattered read' ela= 23 file#=1 block#=100889 blocks=7 obj#=90849 tim=1358862208006594
- WAIT #139831777068160: nam='db file scattered read' ela= 18 file#=1 block#=100896 blocks=5 obj#=90849 tim=1358862208007059
- FETCH #139831777068160:c=1000,e=962,p=13,cr=17,cu=0,mis=0,r=1,dep=0,og=1,plh=196216451,tim=1358862208007371
- STAT #139831777068160 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=17 pr=13 pw=0 time=959 us)'
- STAT #139831777068160 id=2 cnt=2483 pid=1 pos=1 obj=90849 op='INDEX FAST FULL SCAN MAC_IND (cr=17 pr=13 pw=0 time=20481 us cost=5 size=0 card=2607)'
- WAIT #139831777068160: nam='SQL*Net message from client' ela= 342 driver id=1650815232 #bytes=1 p3=0 obj#=90849 tim=1358862208007853
- FETCH #139831777068160:c=0,e=6,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,plh=196216451,tim=1358862208007920
- WAIT #139831777068160: nam='SQL*Net message to client' ela= 5 driver id=1650815232 #bytes=1 p3=0 obj#=90849 tim=1358862208007961
- WAIT #139831777068160: nam='SQL*Net message from client' ela= 507 driver id=1650815232 #bytes=1 p3=0 obj#=90849 tim=1358862208008489
- *** SESSION ID:(64.773) 2013-01-22 13:43:28.010
- *** CONTAINER ID:(1) 2013-01-22 13:43:28.010
- SQL> alter session set events ' immediate trace name treedump level 90849';
- Session altered.
- ----- begin tree dump
- branch: 0x418a19 4295193 (0: nrow: 11, level: 1)
- leaf: 0x418a1a 4295194 (-1: nrow: 246 rrow: 246)
- leaf: 0x418a1b 4295195 (0: nrow: 252 rrow: 252)
- leaf: 0x418a1c 4295196 (1: nrow: 276 rrow: 276)
- leaf: 0x418a1d 4295197 (2: nrow: 254 rrow: 254)
- leaf: 0x418a1e 4295198 (3: nrow: 254 rrow: 254)
- leaf: 0x418a1f 4295199 (4: nrow: 240 rrow: 240)
- leaf: 0x418a20 4295200 (5: nrow: 242 rrow: 242)
- leaf: 0x418a21 4295201 (6: nrow: 225 rrow: 225)
- leaf: 0x418a22 4295202 (7: nrow: 207 rrow: 207)
- leaf: 0x418a23 4295203 (8: nrow: 202 rrow: 202)
- leaf: 0x418a24 4295204 (9: nrow: 85 rrow: 85)
- ----- end tree dump
- branch: 0x418a19 4295193 ==》 file 1 block 100889
- WAIT #139831777068160: nam='db file sequential read' ela= 15 file#=1 block#=100888 blocks=1 obj#=90849 tim=1358862208006472
- SQL> alter system dump datafile 1 block 100888; 10888是segment header
- buffer tsn: 0 rdba: 0x00418a18 (1/100888)
- scn: 0x0000.0029a160 seq: 0x02 flg: 0x04 tail: 0xa1601002
- frmt: 0x02 chkval: 0x84fe type: 0x10=DATA SEGMENT HEADER - UNLIMITED
- Hex dump of block: st=0, typ_found=1
复制代码 结论 INDEX FAST FULL SCAN 确实也应当先scan index segment header
|
|