Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2007
    Posts
    84

    Unanswered: 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

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  3. #3
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Get the snapshot for tables and check rows_written.

    Andy

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  5. #5
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •