以下的文章主要是对Oracle数据的获取方式的相关测试,我们首先是建立相关的实验环境,以下就是其相关的实验环境的示例,如果你想对Oracle数据的获取方式的测试有更好的了解的话,你不妨浏览以下的文章。
createtabletestasselect*fromdba_objectswhere0=1; createindexind_test_idontest(object_id); insertintotestselect*fromdba_objects whereobject_idisnotnullandobject_id>10000orderbyobject_iddesc; analyzetabletestcomputestatisticsfortableforallcolumnsforallindexes; TableAccessFull SQL>setautotracetrace; SQL>selectobject_idfromtest; setautotracetrace; selectobject_idfromtest; |Id|Operation|Name|Rows|Bytes|Cost(%CPU)|Time| 1|TABLEACCESSFULL|TEST|58650|229K|239(1)|00:00:03|
注意这是因为object_id列默认是可以为null的,如果修改成not null那么获取方式会变成什么方式?
IndexFastFullScan altertabletestmodify(object_idnotnull); selectobject_idfromtest; |Id|Operation|Name|Rows|Bytes|Cost(%CPU)|Time| 1|INDEXFASTFULLSCAN|IND_TEST_ID|58650|229K|66(0)|00:00:01| IndexFullScan select/*+index(testind_TEST_ID)*/object_idfromtest; |Id|Operation|Name|Rows|Bytes|Cost(%CPU)|Time| 1|INDEXFULLSCAN|IND_TEST_ID|58650|229K|240(1)|00:00:03| IndexRangeScan select/*+index(testind_TEST_ID)*/object_idfromtestwhereobject_id<68926; |Id|Operation|Name|Rows|Bytes|Cost(%CPU)|Time| 1|INDEXRANGESCAN|IND_TEST_ID|57903|226K|237(1)|00:00:03 SQL>selectobject_idfromtestwhererownum<11;INDEXFASTFULLSCAN OBJECT_ID 68917 68918 68919 68920 68921 68922 68923 68924 68925 68926
已选择10行。
SQL>select/*+index(testind_TEST_ID)*/object_idfromtestwhererownum<11;INDEXFULLSCAN OBJECT_ID 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010
已选择10行。
select*fromtestwhererownum<2; .......69554.......
其他的不关注只关注OBJECT_ID列 。
相关文章
标签:Oracle