- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
5#
发表于 2013-3-6 21:51:55
还是比较容易证明的,详见下面的日志:- SQL> create table macleantest as select * from dba_objects;
- Table created.
- SQL> create unique index pk_test on macleantest(object_id);
- Index created.
- SQL>
- SQL> alter system flush buffer_cache;
- System altered.
- SQL> oradebug setmypid
- Statement processed.
- SQL> oradebug event 10046 trace name context forever,level 8;
- Statement processed.
- SQL> alter system flush buffer_cache;
- System altered.
- alter session set optimizer_dynamic_sampling=0;
- SQL>
- SQL> set autotrace on;
- SQL>
- SQL>
- SQL> set autotrace traceonly;
- SQL>
- SQL> select /*+ rule */ 1 from macleantest where object_id between 2000 and 2500;
- 501 rows selected.
- Execution Plan
- ----------------------------------------------------------
- Plan hash value: 2895836267
- ------------------------------------
- | Id | Operation | Name |
- ------------------------------------
- | 0 | SELECT STATEMENT | |
- |* 1 | INDEX RANGE SCAN| PK_TEST |
- ------------------------------------
- Predicate Information (identified by operation id):
- ---------------------------------------------------
- 1 - access("OBJECT_ID">=2000 AND "OBJECT_ID"<=2500)
- Note
- -----
- - rule based optimizer used (consider using cbo)
- Statistics
- ----------------------------------------------------------
- 0 recursive calls
- 0 db block gets
- 4 consistent gets
- 3 physical reads
- 0 redo size
- 3076 bytes sent via SQL*Net to client
- 520 bytes received via SQL*Net from client
- 2 SQL*Net roundtrips to/from client
- 0 sorts (memory)
- 0 sorts (disk)
- 501 rows processed
-
-
- SQL> oradebug tracefile_name
- /s01/orabase/diag/rdbms/prod/PROD1/trace/PROD1_ora_21065.trc
-
-
-
- PARSING IN CURSOR #140451788454424 len=75 dep=0 uid=0 oct=3 lid=0 tim=1362577258748047 hv=1757295484 ad='99cb9058' sqlid='3j93kt9nbwcvw'
- select /*+ rule */ 1 from macleantest where object_id between 2000 and 2500
- END OF STMT
- PARSE #140451788454424:c=0,e=418,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=3,plh=2895836267,tim=1362577258748040
- EXEC #140451788454424:c=1000,e=47,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=3,plh=2895836267,tim=1362577258748172
- WAIT #140451788454424: nam='SQL*Net message to client' ela= 7 driver id=1650815232 #bytes=1 p3=0 obj#=536 tim=1362577258748226
- WAIT #140451788454424: nam='db file sequential read' ela= 368 file#=1 block#=37921 blocks=1 obj#=17398 tim=1362577258748947
- WAIT #140451788454424: nam='db file sequential read' ela= 286 file#=1 block#=37925 blocks=1 obj#=17398 tim=1362577258749418
- FETCH #140451788454424:c=999,e=1319,p=2,cr=2,cu=0,mis=0,r=1,dep=0,og=3,plh=2895836267,tim=1362577258749583
- WAIT #140451788454424: nam='SQL*Net message from client' ela= 572 driver id=1650815232 #bytes=1 p3=0 obj#=17398 tim=1362577258750229
- WAIT #140451788454424: nam='SQL*Net message to client' ela= 7 driver id=1650815232 #bytes=1 p3=0 obj#=17398 tim=1362577258750311
- WAIT #140451788454424: nam='db file sequential read' ela= 448 file#=1 block#=37926 blocks=1 obj#=17398 tim=1362577258751024
- FETCH #140451788454424:c=1000,e=1188,p=1,cr=2,cu=0,mis=0,r=500,dep=0,og=3,plh=2895836267,tim=1362577258751470
- STAT #140451788454424 id=1 cnt=501 pid=0 pos=1 obj=17398 op='INDEX RANGE SCAN PK_TEST (cr=4 pr=3 pw=0 time=3962 us)'
- WAIT #140451788454424: nam='SQL*Net message from client' ela= 966 driver id=1650815232 #bytes=1 p3=0 obj#=17398 tim=1362577258752619
- *** SESSION ID:(480.1755) 2013-03-06 08:40:58.755
- WAIT #140451788454424: nam='db file sequential read' ela= 368 file#=1 block#=37921 blocks=1 obj#=17398 tim=1362577258748947
- WAIT #140451788454424: nam='db file sequential read' ela= 286 file#=1 block#=37925 blocks=1 obj#=17398 tim=1362577258749418
- WAIT #140451788454424: nam='db file sequential read' ela= 448 file#=1 block#=37926 blocks=1 obj#=17398 tim=1362577258751024
- file#=1 block#=37921
- seg/obj: 0x43f6 csc: 0x00.341a82 itc: 1 flg: - typ: 2 - INDEX
- fsl: 0 fnx: 0x0 ver: 0x01
- Itl Xid Uba Flag Lck Scn/Fsc
- 0x01 0xffff.000.00000000 0x00000000.0000.00 C--- 0 scn 0x0000.00341a82
- Branch block dump
- =================
- header address 140229141850692=0x7f89a42fea44
- kdxcolev 1
- kdxcolev 1 ==》 index level (0 represents leaf blocks)
- file#=1 block#=37925 ==》叶子块
- Object id on Block? Y
- seg/obj: 0x43f6 csc: 0x00.341a82 itc: 2 flg: - typ: 2 - INDEX
- fsl: 0 fnx: 0x0 ver: 0x01
- Itl Xid Uba Flag Lck Scn/Fsc
- 0x01 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
- 0x02 0xffff.000.00000000 0x00000000.0000.00 C--- 0 scn 0x0000.00341a82
- Leaf block dump
- ===============
- header address 140155556162140=0x7f7882236a5c
- kdxcolev 0
- KDXCOLEV Flags = - - -
- kdxcolok 0
- kdxcoopc 0x80: opcode=0: iot flags=--- is converted=Y
- kdxconco 1
- kdxcosdc 0
- kdxconro 513
- kdxcofbo 1062=0x426
- kdxcofeo 1881=0x759
- kdxcoavs 819
- kdxlespl 0
- kdxlende 0
- kdxlenxt 4232230=0x409426
- kdxleprv 4232228=0x409424
-
-
-
- row#451[2613] flag: ------, lock: 0, len=11, data:(6): 00 40 93 3a 00 1b
- col 0; len 2; (2): c2 15
- =====》 c2 15 代表 2000
- SQL> select dump(2000,16) from dual;
- DUMP(2000,16)
- ------------------
- Typ=2 Len=2: c2,15
- file#=1 block#=37926 ==》叶子快
- Object id on Block? Y
- seg/obj: 0x43f6 csc: 0x00.341a82 itc: 2 flg: - typ: 2 - INDEX
- fsl: 0 fnx: 0x0 ver: 0x01
- Itl Xid Uba Flag Lck Scn/Fsc
- 0x01 0x0000.000.00000000 0x00000000.0000.00 ---- 0 fsc 0x0000.00000000
- 0x02 0xffff.000.00000000 0x00000000.0000.00 C--- 0 scn 0x0000.00341a82
- Leaf block dump
- ===============
- header address 140458789124700=0x7fbf1c3b3a5c
- kdxcolev 0
- KDXCOLEV Flags = - - -
- kdxcolok 0
- kdxcoopc 0x80: opcode=0: iot flags=--- is converted=Y
- kdxconco 1
- kdxcosdc 0
- kdxconro 513
- kdxcofbo 1062=0x426
- kdxcofeo 1881=0x759
- kdxcoavs 819
- kdxlespl 0
- kdxlende 0
- SQL> select dump(2500,16) from dual;
- DUMP(2500,16)
- ------------------
- Typ=2 Len=2: c2,1a
- row#438[2769] flag: ------, lock: 0, len=11, data:(6): 00 40 93 40 00 38
- col 0; len 2; (2): c2 1a ==》 2500
-
复制代码 |
|