PARSING IN CURSOR #1 len=55 dep=0 uid=0 oct=42 lid=0 tim=3239940284 hv=3381932903 ad='668aba24'
alter session set events '10046 trace name context off'
END OF STMT
PARSE #1:c=0,e=92,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=3239940275
BINDS #1:
EXEC #1:c=0,e=1028,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=3239947806
SQL> analyze table t compute statistics;
Table analyzed.
SQL> alter session set events '10046 trace name context forever,level 12';
Session altered.
SQL> select count(object_id) from t where object_id>0;
COUNT(OBJECT_ID)
----------------
30536
SQL> alter session set events '10046 trace name context off';
Session altered.
这个现象说明假如表是被分析过的话,采用的就是CBO:
*** 2006-04-21 14:10:18.000
=====================
PARSING IN CURSOR #1 len=68 dep=0 uid=0 oct=42 lid=0 tim=3724965605 hv=570864185 ad='668b0b0c'
alter session set events '10046 trace name context forever,level 12'
END OF STMT
EXEC #1:c=0,e=153,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=3724965598
WAIT #1: nam='SQL*Net message to client' ela= 7 p1=1111838976 p2=1 p3=0
*** 2006-04-21 14:10:28.000
WAIT #1: nam='SQL*Net message from client' ela= 10044728 p1=1111838976 p2=1 p3=0
=====================
PARSING IN CURSOR #1 len=48 dep=0 uid=0 oct=3 lid=0 tim=3735044065 hv=1107120101 ad='677ffa8c'
select count(object_id) from t where object_id>0
END OF STMT
PARSE #1:c=0,e=18398,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=4,tim=3735044052
BINDS #1:
EXEC #1:c=0,e=908,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=3735050327
WAIT #1: nam='SQL*Net message to client' ela= 5 p1=1111838976 p2=1 p3=0
FETCH #1:c=15625,e=16491,p=0,cr=68,cu=0,mis=0,r=1,dep=0,og=4,tim=3735068413
WAIT #1: nam='SQL*Net message from client' ela= 470 p1=1111838976 p2=1 p3=0
FETCH #1:c=0,e=4,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=3735071416
WAIT #1: nam='SQL*Net message to client' ela= 6 p1=1111838976 p2=1 p3=0
WAIT #1: nam='SQL*Net message from client' ela= 3767452 p1=1111838976 p2=1 p3=0
STAT #1 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE '
STAT #1 id=2 cnt=30536 pid=1 pos=1 obj=31690 op='INDEX FAST FULL SCAN IDX_T_ID '
=====================
PARSING IN CURSOR #1 len=55 dep=0 uid=0 oct=42 lid=0 tim=3738845289 hv=3381932903 ad='668aba24'
alter session set events '10046 trace name context off'
END OF STMT
PARSE #1:c=0,e=91,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=3738845282
BINDS #1:
EXEC #1:c=0,e=876,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=3738850186

