文档介绍:oracle,实际执行计划一、什么是执行计划 esspaththatistakenwhenaqueryisexecutedwithinOracle. 二、如何访问数据 ,thelargestisconstrainedbyoperatingsystemlimits(andmultiblocki/o).LogicallyOraclefindsthedatatoreadbyusingthefollowingmethods: FullTableScan(FTS)--全表扫描--索引扫描--物理行idIndexLookup(unique&non-unique)Rowid 三、执行计划层次关系 Whenlookingataplan,therightmost(iemostinndented)uppermostoperationisthefirstthingthatisexecuted.--采用最右最上最先执行的原则看层次关系,在同一级如果某个动作没有子ID就最先执行1、看一个简单的例子: QueryPlan ----------------------------------------- SELECTSTATEMENT[CHOOSE]Cost=1234 **ESSFULLLARGE[:Q65001][ANALYZED]--[:Q65001]表示是并行方式,[ANALYZED]表示该对象已经分析过了优化模式是CHOOSE的情况下,看Cost参数是否有值来决定采用CBO还是RBO: SELECTSTATEMENT[CHOOSE]Cost=1234--Cost有值,采用CBO SELECTSTATEMENT[CHOOSE]Cost= --Cost为空,采用RBO 2、层次的父子关系,看比较复杂的例子: PARENT1 **FIRSTCHILD ****FIRSTGRANDCHILD **SECONDCHILD Herethesameprinciplesapply,theFIRSTGRANDCHILDistheinitialoperationthentheFIRSTCHILDfollowedbytheSECONDCHILDandfinallythePARENTcollatestheoutput. 四、例子解说 ExecutionPlan ---------------------------------------------------------- 0**SELECTSTATEMENTptimizer=CHOOSE(Cost=3Card=8Bytes=248) 10**HASHJOIN(Cost=3Card=8Bytes=248) 21****ESS(FULL)OF'DEPT'(Cost=1Card=3Bytes=36) 31****ESS(FULL)OF'EMP'(Cost=1Card=16Bytes=304) 左侧的两排数据,前面的是序列号ID,后面的是对应的PID。 Ashortenedsummaryofthisis: ExecutionstartswithID=0:SELECTSTATEMENT;butthisisdependandonit'schildobjects;Soitexecutesitsfirstchildstep:ID=1PID=0HASHJOIN;butthisisdependandonit'schildobjects; Soitexecutesitsfirstchildstep:ID=2PID=ESS(FULL)OF'DEPT'; Thenthesecondchildstep:ID=3PID=ESS(FULL)OF'EMP'; Rowsarereturnedtotheparentstep(s)untilfinished 五、表访问方式1、FullTableScan(FTS)全表扫描 InaFTSoperation,thewholetableisreaduptothehighwatermark(HWM)..--全表扫描模式下会读数据到表