借用上面的例子做个参数:
SINGLE TABLE ACCESS PATH
Column (#2): B(NUMBER)
AvgLen: 3.00 NDV: 5 Nulls: 0 Density: 4.4980e-005 Min: 1 Max: 10000
Histogram: Freq #Bkts: 5 UncompBkts: 11116 EndPtVals: 5
Table: TAB_01_03 Alias: T
Card: Original: 11116 Rounded: 10001 Computed: 10000.50 Non Adjusted: 10000.50
Access Path: TableScan
Cost: 6.44 Resp: 6.44 Degree: 0
Cost_io: 6.00 Cost_cpu: 2587949
Resp_io: 6.00 Resp_cpu: 2587949
Access Path: index (index (FFS))
Index: IDX_B
resc_io: 7.00 resc_cpu: 2046392
ix_sel: 0.0000e+000 ix_sel_with_filters: 1
Access Path: index (FFS)
Cost: 7.35 Resp: 7.35 Degree: 1
Cost_io: 7.00 Cost_cpu: 2046392
Resp_io: 7.00 Resp_cpu: 2046392
Access Path: index (AllEqRange)
Index: IDX_B
resc_io: 20.00 resc_cpu: 2143479
ix_sel: 0.89965 ix_sel_with_filters: 0.89965
Cost: 20.37 Resp: 20.37 Degree: 1
Best:: AccessPath: TableScan
Cost: 6.44 Degree: 1 Resp: 6.44 Card: 10000.50 Bytes: 0
choosing an access path
precondition:
(1)first determines which access paths are available by examining the
conditions in the statement's where clause and its from clause.
(2)generates a set of possible execution plans
(3) choose lowest estimated cost
full table scan
关键字:高水位 hight-water mark
all blocks in the table that are under the hight-water mark are scanned.
全表扫描可能读入连续块,通过db_file_multiblock_read_count调整一次IO读取
的块数,参数调高,IO降低,提高扫描效率。
在检索存在大量碎片的表是,全表扫描相对索引扫描会更高效。
什么时候用全表扫描:
(1)lack of index
(2)检索占7成比例的大数据时
(3)small table 一次IO就可以检索完,一次IO的扫描的块数取决于db_file_multiblock_read_count.
参数db_file_multiblock_read_count只有在对表或者索引进行Full Scan的时候才起作用。
多少系统的IO都是1M=db_block_size*db_file_multiblock_read_count
Row Id scan
Rowid表示行在数据块中的具体位置,Rowid是查找具体行的最快方式。可以在WHERE子句中写入Rowid,
但是不推荐这么做。通常都是通过索引来获得Rowid,但如果被检索的行都包含在索引中时,直接访问索引
就能得到所需的数据则不会使用Rowid。 Rowid可能会由于版本的改变而变化,行迁移、行链接、EXP/IMP
也会使Rowid发生变化
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21993926/viewspace-667161/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21993926/viewspace-667161/