RE: explain plan and the real execution plan

From: Lei Zeng <lzeng_at_yahoo-inc.com>
Date: Mon, 16 Nov 2009 21:45:40 -0800
Message-ID: <EB9DFB3B8215BD428634CD68162F55B605109FF1_at_SNV-EXVS06.ds.corp.yahoo.com>



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

Thanks,
Lei


From: Kellyn Pedersen [mailto:kjped1313_at_yahoo.com] Sent: Monday, November 16, 2009 7:41 PM
To: vishal_at_vishalgupta.com; 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

Kellyn Pedersen

Multi-Platform DBA

I-Behavior Inc.

http://www.linkedin.com/in/kellynpedersen  

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

  • On Mon, 11/16/09, Lei Zeng <lzeng_at_yahoo-inc.com> wrote:

From: Lei Zeng <lzeng_at_yahoo-inc.com>
Subject: RE: explain plan and the real execution plan To: vishal_at_vishalgupta.com, "Oracle - L" <oracle-l_at_freelists.org> Date: Monday, November 16, 2009, 4:47 PM

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

Thanks,

Lei  


From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] 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.         

        Regards,

        Vishal Gupta

On 16 Nov 2009, at 23:28, "Lei Zeng" <
<http://us.mc320.mail.yahoo.com/mc/compose?to=lzeng_at_yahoo-inc.com>
lzeng_at_yahoo-inc.com
<http://us.mc320.mail.yahoo.com/mc/compose?to=lzeng_at_yahoo-inc.com> >
wrote:

        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.

Lei    

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Nov 16 2009 - 23:45:40 CST

Original text of this message