软件开发Db2runstats

runstats同时有增删改查表会有影响吗?

想问一下,runstats on table tablename with distribution and detailed indexes all同时表有新增和更新操作有影响吗,看了下runstats的时候表上的IN锁正常来说应该是对insert、update这些操作不影响的吧。还想问下新增索引时是不是数据库默认就会执行runstats,没必要再执行一次1.

参与7

2同行回答

zftangzftang其它小白一枚
默认新增显示全部

默认新增

收起
互联网服务 · 2022-11-13
浏览789
leo_wynleo_wyn商业智能工程师Security
想问一下,runstats on table tablename with distribution and detailed indexes all同时表有新增和更新操作有影响吗,看了下runstats的时候表上的IN锁正常来说应该是对insert、update这些操作不影响的吧 Re: 通常情况下不影响. 请参考如下官方解释:When you start runni...显示全部

想问一下,runstats on table tablename with distribution and detailed indexes all同时表有新增和更新操作有影响吗,看了下runstats的时候表上的IN锁正常来说应该是对insert、update这些操作不影响的吧

Re: 通常情况下不影响. 请参考如下官方解释:

  • When you start running the RUNSTATS command, it acquires an IX table lock on the SYSTABLES table and a U lock on the row of the table on which you are gathering statistics. Operations can still read from the SYSTABLES table, including the row in the table with the U lock. Write operations are also possible if they do not occur against the row with the U lock. However, another reader or writer cannot acquire an S lock on the SYSTABLES table because of the IX lock that the RUNSTATS command acquired.

还想问下新增索引时是不是数据库默认就会执行runstats,没必要再执行一次1.

RE: 这个要看数据库automatic maintennance 中 parameter “AUTO_TBL_MAINT” 设置 ,  通常情况增加index后, 建议手动 runstatus 来 update statistics 

收起
系统集成 · 2022-11-14
浏览776

提问者

jiangnanage
java开发小白
擅长领域: 数据库服务器Db2

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2022-11-11
  • 关注会员:4 人
  • 问题浏览:1615
  • 最近回答:2022-11-14
  • X社区推广