create table test as select * from dba_objects where
create index ind_test_id on test(object_id);
insert into test select * from dba_objects
where object_id is not null and object_id>
analyze table test compute statistics for table for all columns for all indexes;
SQL> set autotrace trace;
SQL> select object_id from test;
set autotrace trace;
select object_id from test;
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
alter table test modify(object_id not null);
select object_id from test;
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
select/*+ index(test ind_TEST_ID)*/ object_id from test;
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
select/*+ index(test ind_TEST_ID)*/ object_id from test where object_id <
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
SQL> select object_id from test where rownum<
OBJECT_ID
已選擇
SQL> select/*+ index(test ind_TEST_ID)*/ object_id from test where rownum<
OBJECT_ID
已選擇
select * from test where rownum <
From:http://tw.wingwit.com/Article/program/Oracle/201311/17932.html