FAST DUAL執行計劃?

lfree發表於2006-04-06

今天發現select sysdate from dual ,它的執行計劃與以前不一樣,結果如下:

http://www.itpub.net/518843.html


SQL> select sysdate from dual ;
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=1)
1 0 FAST DUAL (Cost=2 Card=1)

Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
408 bytes sent via SQL*Net to client
431 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
發現邏輯讀與物理讀都是0,這個是10g的新特性。

FAST DUAL

Description

Provides a more efficient implementation for statements which select a single-row result from DUAL such as SYSDATE, USER or arithmetic calculations

Versions

This operation is implemented in the following versions

10.1.0
10.2.0

Example

This example was developed using Oracle 10.2.0.1 on Linux

This example does not require any table definitions

The statement

    SELECT SYSDATE FROM dual;

generates the following execution plan

0     SELECT STATEMENT Optimizer=CHOOSE
1 0 FAST DUAL

If the "_fast_dual_enabled" parameter is set to FALSE (default TRUE) then the FAST DUAL operation is disabled. For example

    ALTER SESSION SET "_fast_dual_enabled" = FALSE;

Now the statement

    SELECT SYSDATE FROM dual;

generates the following execution plan

0     SELECT STATEMENT Optimizer=CHOOSE
1 0 TABLE ACCESS (FULL) OF 'DUAL'

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

相關文章