Oracle10g的FAST DUAL執行計劃

jlttt發表於2009-04-07

FAST DUAL執行計劃是Oracle10g的新特性。對於利用DUAL進行的計算,可以不用真正的訪問表,從而快速的得到結果。

在實際系統中,由於中介軟體採用了WEBLOGIC,中介軟體為了確保資料庫連線沒有問題,需要在每個SQL前面執行一個SELECT 1 FROM DUAL語句,透過這個執行過程來檢測資料庫連線是否正常。

SQL> SET AUTOT ON
SQL> SELECT 1 FROM DUAL;

1
----------
1

已選擇 1 行。

執行計劃
----------------------------------------------------------
Plan hash value: 1546270724

-----------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-----------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 (0)| 00:00:01 |
| 1 | FAST DUAL | | 1 | 2 (0)| 00:00:01 |
-----------------------------------------------------------------

統計資訊
----------------------------------------------------------
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
509 bytes sent via SQL*Net to client
492 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed

SQL> SELECT * FROM DUAL;

D
-
X

已選擇 1 行。

執行計劃
----------------------------------------------------------
Plan hash value: 3543395131

--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
--------------------------------------------------------------------------

統計資訊
----------------------------------------------------------
0 recursive calls
0 db block gets
3 consistent gets
0 physical reads
0 redo size
512 bytes sent via SQL*Net to client
492 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed

這個新特性由一個新引入的隱含引數_fast_dual_enabled控制,預設為TRUE。[@more@]

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

相關文章