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 > stmtheap and pckcachesz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-03-10, 21:51
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
stmtheap and pckcachesz

Can an increase in stmtheap db cfg value cause the package cache to overflow (adm4500w)? Both stmtheap and pckcachesz are not automatic.
Reply With Quote
  #2 (permalink)  
Old 11-04-10, 08:26
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
If only indirectly. Larger statement heap will allow you to process longer queries, for example, which will take up more space in the statement cache when compiled.
Reply With Quote
  #3 (permalink)  
Old 11-04-10, 21:14
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
This was my initial thought too. Larger statement heap will allow to process more complex statements, but I'm not sure why they would take up more space in the package cache. This is assuming the workload / statement text hasn't changed (and it hasn't according to the customer). Also, SQL is not complex.
Reply With Quote
  #4 (permalink)  
Old 11-05-10, 16:01
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
n_i, You were right.

Response from the expert:
"It's possible that the more complex queries result in more complex access plans which take up more space in the package cache, but I wouldn't generally tie a larger stmtheap with a requirement to increase the package cache."


But if SQL is not complex, why would the access plan change and the statement text is exactly the same as per the customer.
Reply With Quote
  #5 (permalink)  
Old 11-05-10, 16:19
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by db2girl View Post


But if SQL is not complex
I suspect the optimizer may have a different opinion than you (or the client) as to what constitutes a complex statement.
Reply With Quote
  #6 (permalink)  
Old 11-05-10, 16:26
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
The SQL I saw (only several statements) looked pretty simple (to me). Also, the manual states:

"Statement Heap Size (stmtheap)
Although the size of the statement heap does not influence the optimizer in choosing different access paths, it can affect the amount of optimization performed for complex SQL or XQuery statements."
Reply With Quote
  #7 (permalink)  
Old 11-05-10, 17:58
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
The way I read it, the value of STMTHEAP by itself does not influence the optimizer decision (unlike SORTHEAP, for example), however, additional memory will allow it to consider more optimization options, which indeed can result in a different plan.
Reply With Quote
  #8 (permalink)  
Old 11-06-10, 00:42
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
It does make sense.

They have a prod mirror env where explains were performed on some SQL before/after the statement heap change and there was no difference in the plans.


After increasing the statement heap, they started getting package cache overflows as well as high CPU and lock-waits. No diagnostic info was collected prior to reverting the changes back.


My theory about lock-waits. Please let me know what you think:
increase in stmtheap -> increase in amount of optimization -> increase in compile time -> increase in V (variation) lock duration => lock-waits on V (exclusive) lock.

This variation lock is held in exclusive mode when the statement is compiled / loaded into the cache. So, other applications that need to execute exactly the same statement will have to wait until it's compiled / loaded.

The lock-waits could have been on user / catalog tables so V-lock waits is just my theory.
Reply With Quote
  #9 (permalink)  
Old 11-06-10, 10:38
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by db2girl View Post
They have a prod mirror env where explains were performed on some SQL before/after the statement heap change and there was no difference in the plans.


After increasing the statement heap, they started getting package cache overflows as well as high CPU and lock-waits.
Somehow it does not add up.
Reply With Quote
  #10 (permalink)  
Old 11-08-10, 09:48
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Bella, if you still have those explains. check the stats before and after. I wonder if they were changed.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #11 (permalink)  
Old 11-08-10, 10:15
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
I got an update this morning that the problem (high cpu / lock-waits / package cache overflow / etc...) happened again with no change to the statement heap (change was undone last week). So, an increase in stmtheap doesn't seem to related to this perf / cache overflows issue.

I also checked with our optimizer expert (previously it was a package cache expert) and he doesn't think pckcachsz needs to be increased when increasing stmtheap. DB2 can generate a more optimal plan, but it should not be more complex (if previously db2 had to drop down to greedy join enumeration due to hitting statement heap limit).
Reply With Quote
  #12 (permalink)  
Old 11-15-10, 19:16
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Reply With Quote
  #13 (permalink)  
Old 11-21-10, 23:30
Mathew_paul Mathew_paul is offline
Registered User
 
Join Date: Oct 2007
Posts: 200
hi bella,

optimization of statement also depends on the level of optimization wht we set, or as u said increase of the stmtheap results in more optimization of the query ??
redgs
Paul
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