RE: explain plan and the real execution plan
Date: Mon, 16 Nov 2009 21:45:40 -0800
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 [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,
"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?
[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.
On 16 Nov 2009, at 23:28, "Lei Zeng" <
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.
LeiReceived on Mon Nov 16 2009 - 23:45:40 CST