關於COUNT STOPKEY的工作機制

flysky0814發表於2007-11-21

SQL> select rownum rn ,a.* from cnmir.ew_auctions a where rownum<50000;

Execution Plan
----------------------------------------------------------
Plan hash value: 721966694

----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 49999 | 4833K| 163 (2)| 00:00:02 |
|* 1 | COUNT STOPKEY | | | | | |
| 2 | TABLE ACCESS FULL| EW_AUCTIONS | 49999 | 4833K| 163 (2)| 00:00:02 |
----------------------------------------------------------------------------------

SQL> select * from cnmir.ew_auctions where issue_id<80;

Execution Plan
----------------------------------------------------------
Plan hash value: 518049957

---------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 99 | 1379 (2)| 00:00:17 |
|* 1 | TABLE ACCESS FULL| EW_AUCTIONS | 1 | 99 | 1379 (2)| 00:00:17 |
---------------------------------------------------------------------------------

可見COUNT STOPKEY 機制是隻針對rownum而設定的!

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11423276/viewspace-983100/,如需轉載,請註明出處,否則將追究法律責任。

相關文章