链接:
http://lfree.itpub.net/post/4950/284166
create table big_table as select * from dba_objects;
insert into big_table select * from big_table;
insert into big_table select * from big_table;
ALTER TABLE BIG_TABLE MODIFY(OBJECT_ID NULL);
CREATE INDEX I_BT_OBJECT_ID ON BIG_TABLE(OBJECT_ID)
如果修改
select min(object_id),max(object_id) from big_table;
为
select min(object_id),min(object_id) from big_table;
----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 5 | 307 (4)| 00:00:04 |
| 1 | SORT AGGREGATE | | 1 | 5 | | |
| 2 | INDEX FAST FULL SCAN| I_BT_OBJECT_ID | 405K| 1978K| 307 (4)| 00:00:04 |
----------------------------------------------------------------------------------------
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
1386 consistent gets
0 physical reads
0 redo size
484 bytes sent via SQL*Net to client
384 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
可以发现oracle并没有选择合适的执行语句。