Results 1 to 13 of 13
  1. #1
    Join Date
    Sep 2010
    Posts
    34

    Unanswered: how to if runstats is needed

    Hi friends,

    I have a question.

    How to I will determinate the tables need runstats? could I get a view? for example:

    I get tables that need reorg like this:


    call sysproc.reorgchk_tb_stats('T','ALL');

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    All tables need runstats periodically. This updates the statistics so that your reorgchk will actually know what has to be reorged. If you do not update the stats, then your reorgchk finds nothing to reorg. As for how often, to run runstats it is up to you. There are some tables that will never(rarely) change, so runstats run on them will not tell you anything new. Some tables have complete overhauls on the data daily, others still have just a normal workload and could be done weekly/monthly. One of the things I have always advised is if you run runstats, then be prepared to reorg whatever is in need of a reorg, as the optimizer is going to decide on access paths due to the stats, so if the table is in bad shape when you run runstats, then you may get a sub-optimal access path until you run reorgs.

    Dave Nance
    Last edited by dav1mo; 11-12-10 at 16:12.

  3. #3
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    talk to your ETL team, talk to your business unit. Find out how tables are utilized and how they are changed and fly from there.

    There are two distinct way people do them. 1. Do all tables all the time. 2 Do some tables, some times. First as you imagine is easier to do, but does not mean better.
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  4. #4
    Join Date
    Sep 2010
    Posts
    34
    Quote Originally Posted by Cougar8000 View Post
    talk to your ETL team, talk to your business unit. Find out how tables are utilized and how they are changed and fly from there.

    There are two distinct way people do them. 1. Do all tables all the time. 2 Do some tables, some times. First as you imagine is easier to do, but does not mean better.

    Thank you.

    But the monitor show me the tables that need runstats, then I think that I can get a list of tables some way.

  5. #5
    Join Date
    Mar 2008
    Posts
    136
    reorgchk automatically run first runstats then generates report for doing reorg.
    then why need to run runstats before reorgchk??
    Regards
    Pawan Kumar

  6. #6
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Quote Originally Posted by Pawan Kumar View Post
    reorgchk automatically run first runstats then generates report for doing reorg.
    then why need to run runstats before reorgchk??
    Never had lock-problems during runstats... except when invoked from the reorgchk.
    So I'd discourage anyone to let reorgchk do the runstats for you, except when you're in your maintanace window.

  7. #7
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    Quote Originally Posted by robert_tr View Post
    Thank you.

    But the monitor show me the tables that need runstats, then I think that I can get a list of tables some way.
    I do not compute what you are asking/saying. Maybe I just need stronger coffee
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  8. #8
    Join Date
    Sep 2010
    Posts
    34

    Thanks

    Thank's friends, I found the answer:

    db2 GET HEALTH SNAPSHOT FOR DB ON db_name

  9. #9
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by robert_tr View Post
    Thank's friends, I found the answer:

    db2 GET HEALTH SNAPSHOT FOR DB ON db_name
    If you are going to rely on automatic maintenance, you might just enable AUTO_RUNSTATS. Keep in mind though that the health monitor is not necessarily accurate in determining when statistics become stale.

  10. #10
    Join Date
    Sep 2010
    Posts
    34
    Quote Originally Posted by n_i View Post
    If you are going to rely on automatic maintenance, you might just enable AUTO_RUNSTATS. Keep in mind though that the health monitor is not necessarily accurate in determining when statistics become stale.
    OK, thanks, I appreciate it.

  11. #11
    Join Date
    Sep 2015
    Posts
    2

    RUNSTAT in zOS

    what is the equivalent of this in DB2 for zOS? is there such a command "reorgchk" in zOS DB2?

  12. #12
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by macalalad View Post
    what is the equivalent of this in DB2 for zOS? is there such a command "reorgchk" in zOS DB2?
    Yes, at least as far back as Version 7 and probably far before that.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  13. #13
    Join Date
    Sep 2015
    Posts
    2
    Quote Originally Posted by Pat Phelan View Post
    Yes, at least as far back as Version 7 and probably far before that.

    -PatP
    Thanks Pat. are you talking about this "reorgchk" facility? or is it part of the 'REORG' utility?

    Can this reorgchk 'command' or stored procedure be invoked from DB2I as a DB2 command?

    I haven't seen it in any quickref manual (IBM version 10 docos)..

    Just thought I'd ask this for info to any newbie like me.
    Last edited by macalalad; 09-08-15 at 22:14. Reason: to be more direct

Posting Permissions

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