Posts Topics Forums Images
Search videos from message boards Videos Search messages from microblogs Microblogs Search messages from imdb.com Imdb Search messages from yuku.com Yuku Search messages from lefora.com (free forums) Lefora
My account: Login | Sign Up
Loading... 

Thread: same explain plan but different response time between two days

Started 1 month, 3 weeks ago by Mohamed Houri
Two days ago, I run a query which was performing very badly (33 records returned in more than 18 minutes). I then have generated its corresponding explain plan and started looking how to improve it. Finally, when I have changed a little bit the order by clause, the query performed very well. Today, I was going to implement this change of order by clause in...
Site: www.oracle.com  www.oracle.com - site profile
Forum: Database - General   Database - General
 - forum profile
Total authors: 6 authors
Total thread posts: 10 posts
Thread activity: no new posts during last week
Domain info for: oracle.com

Other posts in this thread:

Robert Geier replied 1 month, 3 weeks ago
I think you have answered your own question :- "The only differences are in the numbers of rows, bytes, costs and a new column named TempSpc has been added into the new explain plan." Do all tables and indexes have stats ? Did the two statements use the same bind variables, or different ? E.g select count(*) from employee where gender = &input1;...

Mohamed Houri replied 1 month, 3 weeks ago
And now at 10h30 it is again performing badly with exactly the same explain plan as the one corresponding to this morning very performant query!!! Mohamed Houri

Mohamed Houri replied 1 month, 3 weeks ago
Yes the two statements use the same bind variables. This morning I run the query and it tooks less than 1 seconde to complete. I have just go the time to post my thread and now the same query with the same bind variables are runing very slowly (about 5 minutes to complete). The explain plans of the two statements are now exactly the same. Regards ...

Charles Hooper replied 1 month, 3 weeks ago
Mohamed Houri wrote: Yes the two statements use the same bind variables. This morning I run the query and it tooks less than 1 seconde to complete. I have just go the time to post my thread and now the same query with the same bind variables are runing very slowly (about 5 minutes to complete). The explain plans of the two statements are now exactly...

Mohamed Houri replied 1 month, 3 weeks ago
Thanks Charles, I am using Release 10.2.0.4.0 I am using explain plan for (query goes here.....) and select * from table(dbms_xplan.display) to get the explain plan. Actually the query is runing fast. I will trace it with 10046 level 12 when it will performs badly Regards Mohamed

rjaf replied 1 month, 3 weeks ago
Oracle's bind variable peeking may be at play, here. Have a Google for it - there's good stuff on Jonathan Lewis' site about it. An example: the first query to run one day uses search value "USA" for a query - later, "DCG" is used as the search value. The first query is a lucky one: it leads to an index being used, as "USA" appears very infrequently ...

Charles Hooper replied 1 month, 3 weeks ago
The EXPLAIN PLAN FOR ... syntax may also display inaccurate execution plans. Bind variable peeking does not take place with EXPLAIN PLANs, while it does take place during a normal query parse and execute in 9i and above. Additionally, you could find that all bind variables are treated as VARCHAR2 in an EXPLAIN PLAN. If I recall correctly, EXPLAIN PLAN FOR ...

Jonathan Lewis replied 1 month, 3 weeks ago
Mohamed Houri wrote: Yes the two statements use the same bind variables. This morning I run the query and it tooks less than 1 seconde to complete. I have just go the time to post my thread and now the same query with the same bind variables are runing very slowly (about 5 minutes to complete). The explain plans of the two statements are now exactly...

Farenheiit replied 1 month, 2 weeks ago
Hi all, I prefer to retreive the execution plan with execution stats. Thus you will be able to compare the estimated rows with the number of rows really processed. ex: SELECT * FROM table(dbms_xplan.display_cursor(NULL,NULL,'iostats last')); But you have to add the hint /*+ gather_plan_statistics */ into the sql statement or to set the TIMED_...

 

Top contributing authors

Name
Posts
Mohamed Houri
4
user's latest post:
same explain plan but different...
Published (2009-11-12 06:36:00)
Thanks Charles, I am using Release 10.2.0.4.0 I am using explain plan for (query goes here.....) and select * from table(dbms_xplan.display) to get the explain plan. Actually the query is runing fast. I will trace it with 10046 level 12 when it will performs badly Regards Mohamed
Charles Hooper
2
user's latest post:
same explain plan but different...
Published (2009-11-12 06:59:00)
The EXPLAIN PLAN FOR ... syntax may also display inaccurate execution plans. Bind variable peeking does not take place with EXPLAIN PLANs, while it does take place during a normal query parse and execute in 9i and above. Additionally, you could find that all bind variables are treated as VARCHAR2 in an EXPLAIN PLAN. If I recall correctly, EXPLAIN PLAN FOR should (could?) trigger a hard parse of the SQL statement rather than reusing the...
rjaf
1
user's latest post:
same explain plan but different...
Published (2009-11-12 06:52:00)
Oracle's bind variable peeking may be at play, here. Have a Google for it - there's good stuff on Jonathan Lewis' site about it. An example: the first query to run one day uses search value "USA" for a query - later, "DCG" is used as the search value. The first query is a lucky one: it leads to an index being used, as "USA" appears very infrequently in the table being queried, and a good plan is...
Robert Geier
1
user's latest post:
same explain plan but different...
Published (2009-11-12 01:36:00)
I think you have answered your own question :- "The only differences are in the numbers of rows, bytes, costs and a new column named TempSpc has been added into the new explain plan." Do all tables and indexes have stats ? Did the two statements use the same bind variables, or different ? E.g select count(*) from employee where gender = &input1; The explain plan may be the same for MALE and FEMALE, but the row counts may be very...
Farenheiit
1
user's latest post:
same explain plan but different...
Published (2009-11-13 02:12:00)
Hi all, I prefer to retreive the execution plan with execution stats. Thus you will be able to compare the estimated rows with the number of rows really processed. ex: SELECT * FROM table(dbms_xplan.display_cursor(NULL,NULL,'iostats last')); But you have to add the hint /*+ gather_plan_statistics */ into the sql statement or to set the TIMED_STATISTICS parameter to ALL.
Jonathan Lewis
1
user's latest post:
same explain plan but different...
Published (2009-11-12 14:12:00)
Mohamed Houri wrote: Yes the two statements use the same bind variables. This morning I run the query and it tooks less than 1 seconde to complete. I have just go the time to post my thread and now the same query with the same bind variables are runing very slowly (about 5 minutes to complete). The explain plans of the two statements are now exactly the same. Charles, and others, have pointed out the problems of using "explain plan"...

Related threads on "www.oracle.com":

Related threads on other sites:

Thread profile page for "same explain plan but different response time between two days" on http://www.oracle.com. This report page is a snippet summary view from a single thread "same explain plan but different response time between two days", located on the Message Board at http://www.oracle.com. This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity