签到成功

知道了

CNDBA社区CNDBA社区

SQL2314W when using runstats with inconsistent statistics

2022-07-05 13:45 1362 0 原创 DB2
作者: hbhe0316

Question & Answerhttp://www.cndba.cn/hbhe0316/article/108523

Question
Performing the RUNSTATS command while a table is being updated is possible but the statistics could be inconsistent depending on the level of update activity. You may receive the following warning: SQL2314W Some statistics are in an inconsistent state. The newly collected “” statistics are inconsistent with the existing “” statistics.

http://www.cndba.cn/hbhe0316/article/108523

Cause
A sub-optimal plan might result when the statistics are inconsistent. SQL2314W is a warning of that possibility.

http://www.cndba.cn/hbhe0316/article/108523
http://www.cndba.cn/hbhe0316/article/108523
http://www.cndba.cn/hbhe0316/article/108523

Answer
You should try to issue the RUNSTATS command when the activity level is as low activity as possible (or with no activity if possible). In particular, you should try to run RUNSTATS when there is little update activity.http://www.cndba.cn/hbhe0316/article/108523

In addition, you could issue RUNSTATS with the optional “ALLOW READ ACCESS” clause, which prevents others from modifying the table while RUNSTATS is running. This clause will affect concurrency since any applications trying to modify the table will be required to wait. To reduce the time period that the table is locked during RUNSTATS with ALLOW READ ACCESS, consider using the TABLESAMPLE clause: this results in RUNSTATS gathering statistics on a sample of the data in the table rather than all of it. A judicious choice of sample size can speed up RUNSTATS while still ensuring statistical integrity.http://www.cndba.cn/hbhe0316/article/108523http://www.cndba.cn/hbhe0316/article/108523

If none of the suggestions above can be used to prevent the SQL2314W warning and a review of query access plans shows some questionable choices when accessing the affected table, you could consider marking the table “volatile” to encourage index accesses.http://www.cndba.cn/hbhe0316/article/108523http://www.cndba.cn/hbhe0316/article/108523

版权声明:本文为博主原创文章,未经博主允许不得转载。

DB2

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
hbhe0316

hbhe0316

关注

1.只有承认无知,才能装下新的东西; 2.进步来自一点点滴滴的积累; 3.广博让你更优秀,而专业让你无法替代; 4.挫折和失败能够转换为一种财富。

  • 889
    原创
  • 1
    翻译
  • 13
    转载
  • 24
    评论
  • 访问:2588499次
  • 积分:1523
  • 等级:核心会员
  • 排名:第6名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ