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 > DB2 > Access plan takes long - visual explain

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-04-06, 08:19
ggnanaraj ggnanaraj is offline
Registered User
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 171
Access plan takes long - visual explain

There is a complex query involving 12 tables (1 very huge table & 5 huge tables) having a cost of about 400 timerons. However, to generate the access plan it takes about 15 minutes. The optimization level is at default 5. If the optimization level is changed to 1, the access plan is generated instantaneously. No aggregate function is used in the SQL statement.

Cannot change DFT_QUERYOPT as this will affect all SQL statements from the application to the database.

Did consider changing DFT_DEGREE, however, this applies to all SQL statements which could affect online.

How can this issue be resolved?

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 09-04-06, 19:44
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Are you telling about the Visual explain tool taking long to show the explain path ... if this is the case, I wouldn't bother how long it takes to generate the access plan ...What is the query compile time (can be captured from the stmt snapshot) for the two cases as compared to the query execution time?

Have you considered SET CURRENT QUERY OPTIMIZATION stmt?

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 09-05-06, 02:22
ggnanaraj ggnanaraj is offline
Registered User
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 171
Thanks for the input.

The time taken for the access plan to be displayed is the approximate compile time for the SQL... which is about 15 minutes... however the cost of the SQL is 200 timerons.

Have now resolved to use 'SET CURRENT QUERY OPTIMIZATION' for select SQL where the compile time is high.
Reply With Quote
  #4 (permalink)  
Old 09-05-06, 05:53
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Just a thought ... Have you tried increasing stmtheap and checked if this makes a difference ?

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 09-06-06, 01:17
ggnanaraj ggnanaraj is offline
Registered User
 
Join Date: Aug 2002
Location: Chennai, India
Posts: 171
STMTHEAP is about 64 MB.
SQL statement heap (4KB) (STMTHEAP) = 16384
However, let me check and see if this makes a difference.

Thanks
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