If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > Unusual high query execution time

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-25-10, 16:53
rahul_pat1748 rahul_pat1748 is offline
Registered User
 
Join Date: Aug 2010
Posts: 4
Unusual high query execution time

Hi,

I am facing a very strange issue with one of our Oracle query. The query is usually completes in a minute or two. Even the execution plan of the query is good and it works perfect most of the times, as expected. The query fetches about 1000-2000 records each day.

But on a given day, the query takes about 30-40 mins to execute completely. Upon checking the load on DB server, there are no other processes running which can impact the run time of this query. Moreover, the record counts fetched are almost same as compared to other days. There is no pattern observed as that this phenomenon occurs. it all happens once in a while.

Configuration is Oracle 10g with RAC environment on LINUX

Any suggestions are welcome.
Reply With Quote
  #2 (permalink)  
Old 08-25-10, 16:58
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Is the query using bind variables?
In case the query is slow, are you using variable values that are different compared to those where it runs fast?
Reply With Quote
  #3 (permalink)  
Old 08-25-10, 18:06
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 6,407
post EXPLAIN PLAN for both slow & fast queries
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
  #4 (permalink)  
Old 08-26-10, 09:11
rahul_pat1748 rahul_pat1748 is offline
Registered User
 
Join Date: Aug 2010
Posts: 4
It is a single query and the explain plan of the query is same. We are not changing anything in the query. The query is a part of a regular nightly ETL job.

Also, there are no bind variables used in the query. It is a straight forward SQL query.
Reply With Quote
  #5 (permalink)  
Old 08-26-10, 09:14
rahul_pat1748 rahul_pat1748 is offline
Registered User
 
Join Date: Aug 2010
Posts: 4
As per our DBA recommendations, we do apply some parameter settings changes in ETL job before the query runs each day:

alter session set optimizer_index_caching=15;

alter session set optimizer_index_cost_adj=85;


But it is not helping much as we can still see a high query execution time on a given day.
Reply With Quote
  #6 (permalink)  
Old 08-26-10, 09:43
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 6,407
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
  #7 (permalink)  
Old 08-26-10, 09:45
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Quote:
Originally Posted by rahul_pat1748 View Post
It is a single query and the explain plan of the query is same. We are not changing anything in the query. The query is a part of a regular nightly ETL job.

Also, there are no bind variables used in the query. It is a straight forward SQL query.
My first guess is that you were hit by the problem caused by bind variable peeking. But if you don't have bind variables, that guess was apparently wrong.

I think the only chance you have, is to turn on tracing before the slow statement is executed and then analyze the trace to see where the time is spent.
Reply With Quote
  #8 (permalink)  
Old 08-26-10, 10:05
rahul_pat1748 rahul_pat1748 is offline
Registered User
 
Join Date: Aug 2010
Posts: 4
"I think the only chance you have, is to turn on tracing before the slow statement is executed and then analyze the trace to see where the time is spent. "

The problem is : It is a same query and nothing like a slow and fast query. Regularly the query executes in a minute and sometime it peaks at takes 35-40 mins. We don't know, on which day will it take long time to run and on that day put the trace on. Its completely unexpected behavior and no pattern applies.
Reply With Quote
  #9 (permalink)  
Old 08-26-10, 10:24
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Quote:
Originally Posted by rahul_pat1748 View Post
Regularly the query executes in a minute and sometime it peaks at takes 35-40 mins. We don't know, on which day will it take long time to run and on that day put the trace on. Its completely unexpected behavior and no pattern applies.
Then you need to enable tracing every time the statement is run.
Reply With Quote
  #10 (permalink)  
Old 08-26-10, 10:36
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 6,407
please post SQL & EXPLAIN PLAN
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
  #11 (permalink)  
Old 08-26-10, 13:04
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,455
Cool Awr?

Quote:
Originally Posted by rahul_pat1748 View Post
... Etc ...
We don't know, on which day will it take long time to run and on that day put the trace on. Its completely unexpected behavior and no pattern applies.
Did you generate AWR report for the day/time this occurs?
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On