dbTalk Databases Forums  

what stmts in package cache reads from table?

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss what stmts in package cache reads from table? in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Lennart Jonsson
 
Posts: n/a

Default what stmts in package cache reads from table? - 11-22-2010 , 03:18 PM






What is the best way to identify which statements in the package cache
that reads from a certain table? I'm not to happy with:

select ...
from sysibmadm.snapdyn_sql
where ucase(cast(stmt_text as varchar(10000))) like '%<tablename> %'

so I'm wondering if there is a better way?


/Lennart

Reply With Quote
  #2  
Old   
Frederik Engelen
 
Posts: n/a

Default Re: what stmts in package cache reads from table? - 11-22-2010 , 05:30 PM






On 22 nov, 22:18, Lennart Jonsson <erik.lennart.jons... (AT) gmail (DOT) com>
wrote:
Quote:
What is the best way to identify which statements in the package cache
that reads from a certain table? I'm not to happy with:

* * select ...
* * from sysibmadm.snapdyn_sql
* * where ucase(cast(stmt_text as varchar(10000))) like '%<tablename>%'

so I'm wondering if there is a better way?

/Lennart
Don't forget the views on that table...

For the rest of your question, I don't think there's much choice.

You sound like you're trying to implement some performance course best
practices ;-)
--
Frederik Engelen

Reply With Quote
  #3  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: what stmts in package cache reads from table? - 11-22-2010 , 11:40 PM



On 2010-11-23 00:30, Frederik Engelen wrote:
Quote:
On 22 nov, 22:18, Lennart Jonsson <erik.lennart.jons... (AT) gmail (DOT) com
wrote:
What is the best way to identify which statements in the package cache
that reads from a certain table? I'm not to happy with:

select ...
from sysibmadm.snapdyn_sql
where ucase(cast(stmt_text as varchar(10000))) like '%<tablename> %'

so I'm wondering if there is a better way?

/Lennart

Don't forget the views on that table...

For the rest of your question, I don't think there's much choice.
My guess to, I was kinda hoping that I've missed something obvious. It
would have been pretty cool if one could retrieve info from the
compilation of the stmt (such as operands and operators in the access
plan). I guess I just have to refine the where clause one way or another.

Quote:
You sound like you're trying to implement some performance course best
practices ;-)
:-) We haven't found any 2.2 million dollar queries yet, but I'm pretty
sure that we earned the conference fee back.


/Lennart

Reply With Quote
  #4  
Old   
Serge Rielau
 
Posts: n/a

Default Re: what stmts in package cache reads from table? - 11-23-2010 , 06:06 AM



Which version of DB2 are you on?
9.7 has a bunch of new and much more lightweight APIs

Cheers
Serge


--
Serge Rielau
SQL Architect DB2 for LUW, IBM Toronto Lab
Blog: tinyurl.com/SQLTips4DB2
Wiki: tinyurl.com/Oracle2DB2Wiki
Twitter: srielau

Reply With Quote
  #5  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: what stmts in package cache reads from table? - 11-23-2010 , 07:40 AM



On 2010-11-23 13:06, Serge Rielau wrote:
Quote:
Which version of DB2 are you on?
9.7 has a bunch of new and much more lightweight APIs
9.5 and AFAIK there are no plans of upgrading in a nearby future.


/Lennart

Reply With Quote
  #6  
Old   
Willem Fischer
 
Posts: n/a

Default Re: what stmts in package cache reads from table? - 11-25-2010 , 06:16 PM



On Nov 23, 2:40*pm, Lennart Jonsson <erik.lennart.jons... (AT) gmail (DOT) com>
wrote:
Quote:
On 2010-11-23 13:06, Serge Rielau wrote:

Which version of DB2 are you on?
9.7 has a bunch of new and much more lightweight APIs

9.5 and AFAIK there are no plans of upgrading in a nearby future.

/Lennart
Theoretically, db2advis can explain all tables currently in the
package cache and you could retrieve the table names from the explain
tables...

Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.