Home » RDBMS Server » Performance Tuning » Different EXPLAIN PLAN Before and after execution (Oracle 10g)
Different EXPLAIN PLAN Before and after execution [message #457524] Tue, 25 May 2010 01:20 Go to next message
prateekgupta1210
Messages: 5
Registered: May 2010
Location: Mumbai
Junior Member
Hello,

I was working upon a query (database : Oracle , Version 10.2.0.4.0) , I found that the EXPLAIN PLAN for the query before execution and after execution were different.

Can this be possible ?

Note :- Statistics of the underline tables were gather properly.

Thanks,
-Prateek
Re: Different EXPLAIN PLAN Before and after execution [message #457528 is a reply to message #457524] Tue, 25 May 2010 01:27 Go to previous messageGo to next message
Michel Cadot
Messages: 68650
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Can this be possible ?

Yes (and you saw it).

Regards
Michel

Re: Different EXPLAIN PLAN Before and after execution [message #457530 is a reply to message #457528] Tue, 25 May 2010 01:32 Go to previous messageGo to next message
prateekgupta1210
Messages: 5
Registered: May 2010
Location: Mumbai
Junior Member
I mean , I would like to know the reason .

This is seriously affecting the system performance . What are the remedies ?

Thanks,
-Prateek
Re: Different EXPLAIN PLAN Before and after execution [message #457531 is a reply to message #457530] Tue, 25 May 2010 01:51 Go to previous messageGo to next message
Michel Cadot
Messages: 68650
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Explain plan is a guess not a real plan, only execution plan is a real one.
All depends on the environment you parse and execute the query.
See parsing, in addition run time can choose to change part of the choosen execution plan to fit the current run time environment.

Regards
Michel

[Updated on: Tue, 25 May 2010 01:52]

Report message to a moderator

Re: Different EXPLAIN PLAN Before and after execution [message #457559 is a reply to message #457531] Tue, 25 May 2010 03:44 Go to previous messageGo to next message
prateekgupta1210
Messages: 5
Registered: May 2010
Location: Mumbai
Junior Member
Thanks Michel,

Even this has not resolve my problem.

I will list down my observations :-

1) I generated the explain plan of a query (say , query A) , ran the query A (the query A keep running for 20 mins , then i cancel the execution).
2) I added some HINTS (ordered) and modifed query A (name the modified query with hint as query B).
3) Check the Explain Plan for query B (different for that of step 1) , ran the query B (it took around 2 min to complete).
4) I again checked the Explane Plan for query A (this time it was same as query B [with hint one]) and it completed in less that 2 mins as well.

Thanks,
-Prateek
Re: Different EXPLAIN PLAN Before and after execution [message #457571 is a reply to message #457559] Tue, 25 May 2010 04:22 Go to previous messageGo to next message
Michel Cadot
Messages: 68650
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
How can we be sure that your observations is what happened?

Regards
Michel
Re: Different EXPLAIN PLAN Before and after execution [message #457849 is a reply to message #457559] Wed, 26 May 2010 02:59 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
The reason why we want to see evidence of what's happened is that it is not unheard of for people to make mistakes, or misunderstand what is going on.
With something like output from SQL*Plus, we can all see what happened.

In this case, you're saying that without anything else happening, the execution plan of query A changed between step 1 and 4.
This is a little tricky to believe on face value.

If you can show us that it's definitely happened, then that's a different matter.
Re: Different EXPLAIN PLAN Before and after execution [message #457853 is a reply to message #457849] Wed, 26 May 2010 03:33 Go to previous message
prateekgupta1210
Messages: 5
Registered: May 2010
Location: Mumbai
Junior Member
Hey ,

I would definitly like to show you , but now its difficult for me to replicate the same .

Any how my problem is resolved .

What my main aim was to gain performance , earlier , underlying tables used in the query A were populated
just before the exection of the query A . Statistics are gather on the underlying tables long after that .

What I did in my stored procedure is to ANALYZE the underlying tables just before the query A execution.

This has improve the performance considerably .(earlier execution time 7 hrs 10 min & execution time after change : 9 mins )

Cheers Smile ,
-Prateek

Previous Topic: AWR report evaluation
Next Topic: V$SESSION_LONGOPS - Looking for more than last 16 ops
Goto Forum:
  


Current Time: Sun May 12 11:24:57 CDT 2024