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 > How to tell if Runstats needs to be run for Tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-05-11, 15:50
rockycj rockycj is offline
Registered User
 
Join Date: Feb 2007
Posts: 73
How to tell if Runstats needs to be run for Tables

I'm currently using DB2 9.1 LUW. Is there a way to tell if a Runstats needs to be run (if there were modified tables done)?

I was thinking that the syscat.tables would give me this information but I'm not seeing anything that tells me if the table has been modified and needs a runstats run since the last runstats.

Could someone help me out here and tell me how they know. Is there any SQL you run to find this out quickly?

Thank you.

CC
Reply With Quote
  #2 (permalink)  
Old 10-05-11, 16:47
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
You should run runstats when there have been changes to the number of rows caused by inserts and deletes, or changes to overflow characterstics of the rows (caused by updates), or other material changes to the data. The only way you know these things is to run runstats, so you are screwed in an infinite loop.

Just run it once a week, and I would recommend that you use "WITH DISTRIBUTION ON KEY COLUMNS AND DETAILED INDEXES ALL" option. If you have extremely large tables and it is taking too long to do runstats, then use sampling (see the manual). Usually good idea to also run on catalog tables, especially since it will not take a long time to do them.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 10-05-11, 16:48
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Get the snapshot for tables and check rows_written.

Andy
Reply With Quote
  #4 (permalink)  
Old 10-05-11, 20:53
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by ARWinner View Post
Get the snapshot for tables and check rows_written.

Andy
Unless a DBA is making minimum wage, or working on a mainframe with charge backs for CPU time, it is almost always much more cost efficient to just run the runstats on some periodic basis rather than trying to figure out when it needs to be run.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 10-06-11, 09:21
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Quote:
Originally Posted by Marcus_A View Post
Unless a DBA is making minimum wage, or working on a mainframe with charge backs for CPU time, it is almost always much more cost efficient to just run the runstats on some periodic basis rather than trying to figure out when it needs to be run.

I agree. That is what we do, we just runstats on everything once a month whether there were any changes to each table or not. That is far easier to do then to examine if there were any changes and then if those changes are significant for that table to warrant having runstats performed.

Andy
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