dbTalk Databases Forums  

Best way to tell when runstats is needed...

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


Discuss Best way to tell when runstats is needed... in the comp.databases.ibm-db2 forum.



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

Default Best way to tell when runstats is needed... - 01-27-2011 , 06:02 PM






DB2 V9.5 on AIX...I am looking for a better way to tell when runstats
is needed. AUTO_MAINT AUTO RUNSTATS does not seem to do the trick so
we added code to at least look at the cardinality and if the
cardinality vs the true number of rows in the table (from COUNT(*) are
10% different we do a runstats.

However, that is good only for changes due to inserts/deletes. We
still have some issues where runstats is needed just from updates and
the card hasnt changed recently. The results end up being occasional
deadlocks when doing MERGES.

DB2 has advised us to do a runstats if the UDI value returned from the
db2pd -tcbstats command is > 50% of the value of cardinality. The
Support gal advised there is no system table that contains the UDI
value and its only held in the pd memory.

I can easily capture the value of UDI using a script but what I want
to do is retrieve the value from C code. OR find a different way to
determine whether runstats is needed. This is the current output of
the db2pd command:

Quote:
db2pd -tcbstats tbspaceid=5 tableid=6 -db houstondb
Database Partition 0 -- Database HOUSTONDB-- Active -- Up 0 days
19:13:05 -- Date 01/27/2011 23:58:13

TCB Table Information:
Address TbspaceID TableID PartID MasterTbs MasterTab
TableName SchemaNm ObjClass DataSize LfSize LobSize
XMLSize
0x07000000EF038858 5 6 n/a 5 6
EVALUES IMAIN Perm 178969 0 0
0

TCB Table Stats:
Address TableName SchemaNm Scans UDI
RTSUDI PgReorgs NoChgUpdts Reads FscrUpdates
Inserts Updates Deletes OvFlReads OvFlCrtes RowsComp
RowsUncomp CCLogReads StoreBytes BytesSaved
0x07000000EF038858 EVALUES IMAIN 6 67308
67308 0 5072 51292579 1112
10000 57308 0 0 0 0
0 57 - -

Sorry for the lousy formatting but its the UDI value (in this case
67308). As you can see the value can be big so returning it from a
script via a system call would not work either.

Any suggestions?

Reply With Quote
  #2  
Old   
sanjay kumar
 
Posts: n/a

Default Re: Best way to tell when runstats is needed... - 02-11-2011 , 03:32 AM






There is no such thing in DB2 afaik. You will have to use your own judgement tools based on facts. It could be periodic runstats (which works great for me, I run it every Sundays). DB2 doesn't track any details about number of UDI statements. Ofcourse it would have been good but if you need it, you can write your custom scripts to get this information. Try utilizing event monitors...

Quote:
On Thursday, January 27, 2011 7:02 PM shorti wrote:

DB2 V9.5 on AIX...I am looking for a better way to tell when runstats
is needed. AUTO_MAINT AUTO RUNSTATS does not seem to do the trick so
we added code to at least look at the cardinality and if the
cardinality vs the true number of rows in the table (from COUNT(*) are
10% different we do a runstats.

However, that is good only for changes due to inserts/deletes. We
still have some issues where runstats is needed just from updates and
the card hasnt changed recently. The results end up being occasional
deadlocks when doing MERGES.

DB2 has advised us to do a runstats if the UDI value returned from the
db2pd -tcbstats command is > 50% of the value of cardinality. The
Support gal advised there is no system table that contains the UDI
value and its only held in the pd memory.

I can easily capture the value of UDI using a script but what I want
to do is retrieve the value from C code. OR find a different way to
determine whether runstats is needed. This is the current output of
the db2pd command:


Database Partition 0 -- Database HOUSTONDB-- Active -- Up 0 days
19:13:05 -- Date 01/27/2011 23:58:13

TCB Table Information:
Address TbspaceID TableID PartID MasterTbs MasterTab
TableName SchemaNm ObjClass DataSize LfSize LobSize
XMLSize
0x07000000EF038858 5 6 n/a 5 6
EVALUES IMAIN Perm 178969 0 0
0

TCB Table Stats:
Address TableName SchemaNm Scans UDI
RTSUDI PgReorgs NoChgUpdts Reads FscrUpdates
Inserts Updates Deletes OvFlReads OvFlCrtes RowsComp
RowsUncomp CCLogReads StoreBytes BytesSaved
0x07000000EF038858 EVALUES IMAIN 6 67308
67308 0 5072 51292579 1112
10000 57308 0 0 0 0
0 57 - -

Sorry for the lousy formatting but its the UDI value (in this case
67308). As you can see the value can be big so returning it from a
script via a system call would not work either.

Any suggestions?

Quote:
Submitted via EggHeadCafe
ASP.NET Base64 Image Encoding via the Data: protocol
http://www.eggheadcafe.com/tutorials...-protocol.aspx

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.