SQL Server自动更新统计信息的基本算法
Jun 07, 2016 pm 06:07 PM最初接触SQL Server的时候认为SQLServer数据更改的同时就会相应的更新统计信息,其实SQL Server不是这样做的.基于性能考虑,SQL Server使用下面的算法更新统计信息
自动更新统计信息的基本算法是:· 如果表格是在 tempdb 数据库表的基数是小于 6,自动更新到表的每个六个修改。
· 如果表的基数是大于 6,但小于或等于 500,更新状态每 500 的修改。
· 如果基数大于 500,表为更新统计信息时(500 + 20%的表)发生了更改。
· 表变量为基数的更改不会触发自动更新统计信息。
注意:此严格意义上讲,SQL Server 计算基数为表中的行数。
注意:除了基数,该谓语的选择性也会影响 AutoStats 生成。这意味着该统计信息可能无法更新的 afer 每 500 修改基数是 500。比例因子(值的范围从 1 到 4、 1 和 4 之间)上生成根据选择性,这一因素的更改从算法获得数的乘积 AutoStats 生成所需的修改的实际数目。
在表的窗体中,可以summarised 以上算法:
_________________________________________________________________________________
Table Type | Empty Condition | Threshold WhenEmpty |Threshold When Not Empty
_________________________________________________________________________________
Permanent | = 500 | # of Changes >=500 + (20% of Cardinality)
___________________________________________________________________________
Temporary | = 6 | # of Changes >=500 + (20% of Cardinality)
___________________________________________________________________________
Table
Variables | Change in cardinality does not affectAutoStats generation.
___________________________________________________________________________

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to disable Windows Update from automatically updating drivers in win11?

How to disable automatic updates in Win11

Group policy method to turn off automatic updates in win10

How to turn off automatic updates when downloading office 2016 - How to turn off automatic updates when downloading office 2016

How to develop a feature that automatically updates a WordPress plugin

How does Kirin OS provide automatic update and upgrade functions?

How to turn off automatic updates on Redmi 13c?

How to cancel automatic updates in win10 safe mode
