RE: explain plan and the real execution plan

From: Lei Zeng <>
Date: Mon, 16 Nov 2009 21:45:40 -0800
Message-ID: <>

Would dynamic sampling generates different stats each time if the underlying table stays static ( no ddl or dml change, no new indexes, ... nothing changes ) ?  


From: Kellyn Pedersen [] Sent: Monday, November 16, 2009 7:41 PM
To:; Oracle - L; Lei Zeng Subject: RE: explain plan and the real execution plan  

Yes- After your explain plan and then upon executing the statement, dynamic sampling could easily occur and calculate a better execution plan, utilizing it for the actual execution than it did for the explain plan.

A quick trace of the session would capture the statement, (You are looking for OPT_DYN statement for one or more tables involved..) or if unable to reproduce, you could look in the SQL history, either through AWR or through OEM.  

Hope this helps,


Kellyn Pedersen

Multi-Platform DBA

I-Behavior Inc.  

"Go away before I replace you with a very small and efficient shell script..."

  • On Mon, 11/16/09, Lei Zeng <> wrote:

From: Lei Zeng <>
Subject: RE: explain plan and the real execution plan To:, "Oracle - L" <> Date: Monday, November 16, 2009, 4:47 PM

Suppose I am using the same session to run both. Could it be different?



[] On Behalf Of Vishal Gupta Sent: Monday, November 16, 2009 3:39 PM
To: Oracle - L
Subject: Fwd: explain plan and the real execution plan    

        Changes in explain plan and real execution plan depends on the env differences between the sessions in which you are explain planning and the one in which you are executing the statement. Sometimes app changes session level parameters at login time which can change execution plan.         


        Vishal Gupta

On 16 Nov 2009, at 23:28, "Lei Zeng" <
<> >

        Hi, all:

        I have a question about the explain plan.          

Under what conditions, could the plan I get out of 'explain plan' differ from what I get from running the sql statement?  

Suppose the database has no change during I ran 'explain plan' and run the sql - I mean, no ddl and dml - You would think this database is static. Or the time gap between I run 'explain plan' and run sql statement is too narrow to allow any change (ideal environment). No bind variable peeking because _optim_peek_user_binds is set to FALSE.  

Any idea? Thanks in advance.


Received on Mon Nov 16 2009 - 23:45:40 CST

Original text of this message