create table for tablescan test
SQL> execute dbms_random.seed(0)
PL/SQL procedure successfully completed
SQL> create table test_tablescan pctfree 99 pctused 1 as
2 select rownum id,
3 trunc(100*dbms_random.normal) val,
4 rpad('x',100) padding
5 from all_objects
6 where rownum<10000
7 ;
SQL> select * from test_tablescan;
ID VAL PADDING
---------- ---------- --------------------------------------------------------------------------------
1 -69 x
2 -72 x
3 -18 x
4 -62 x
5 -5 x
6 61 x
7 -33 x
8 -170 x
display the last explain plan sql output:
SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY())
Why a Full Table Scan Is Faster for Accessing Large Amounts of Data
Full table scans are cheaper than index range scans when accessing a large fraction of the blocks in a table. This is because full table scans can use larger I/O calls, and making fewer large I/O calls is cheaper than making many smaller calls.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20945761/viewspace-558023/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/20945761/viewspace-558023/