最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

sqlserver统计信息自动更新

来源:动视网 责编:小采 时间:2020-11-09 07:40:43
文档

sqlserver统计信息自动更新

sqlserver统计信息自动更新:对于已经应用的表(非临时表)统计信息更新条件为500+20%,具体更新条件 If the statistics is defined on a regular table, it is out of date if: The table size has gone from 0 to 0 rows. The number of r
推荐度:
导读sqlserver统计信息自动更新:对于已经应用的表(非临时表)统计信息更新条件为500+20%,具体更新条件 If the statistics is defined on a regular table, it is out of date if: The table size has gone from 0 to 0 rows. The number of r


对于已经应用的表(非临时表)统计信息更新条件为500+20%,具体更新条件 If the statistics is defined on a regular table, it is out of date if: The table size has gone from 0 to 0 rows. The number of rows in the table when the statistics were gath

对于已经应用的表(非临时表)统计信息更新条件为500+20%,具体更新条件

If the statistics is defined on a regular table, it is out of date if:

  1. The table size has gone from 0 to >0 rows.

  2. The number of rows in the table when the statistics were gathered was 500 or less, and the colmodctr of the leading column of the statistics object has changed by more than 500 since then.

  3. The table had more than 500 rows when the statistics were gathered, and the colmodctr of the leading column of the statistics object has changed by more than 500 + 20% of the number of rows in the table when the statistics were gathered.

  • If the statistics object is defined on a temporary table, it is out of date as discussed above, except that there is an additional threshold for recomputation at 6 rows, with a test otherwise identical to test 2 in the previous list.

  • 在一些较大的表中触发此更新条件的周期可能较长,因为可能影响查询的性能.在此介绍sqlserver 的一个trace flag 2371

    当开启这个flag时,统计信息的更新将会根据表数据量的总体大小动态调整触发更新条件

    (如1000000数据 30000就会触发更新(3%),1000000000数据1000000就会触发(0.1%)),从而有可能提高系统整体性能.

    如图所示

    注意:由于更新统计信息本身也是有一定得资源消耗,开启后会造成统计信息更新相对频繁,所以开启前应全面评估整体成本.

    (如未因统计信息更新对全局造成明显影响则无需开启)

    个人想法:关系型数据库发展至今,所有产品差别越来越小,细节更能体现一款产品的优秀程度.

    2371的特性如果能作为一个库的option设置,细化粒度(数据库根据用途可能导致访问特点不尽相同),将会使统计信息的管理更合理灵活.

    文档

    sqlserver统计信息自动更新

    sqlserver统计信息自动更新:对于已经应用的表(非临时表)统计信息更新条件为500+20%,具体更新条件 If the statistics is defined on a regular table, it is out of date if: The table size has gone from 0 to 0 rows. The number of r
    推荐度:
    • 热门焦点

    最新推荐

    猜你喜欢

    热门推荐

    专题
    Top