Home Database Mysql Tutorial SQL Server自动更新统计信息的基本算法

SQL Server自动更新统计信息的基本算法

Jun 07, 2016 pm 06:07 PM
Automatic updates

最初接触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.
___________________________________________________________________________
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to disable Windows Update from automatically updating drivers in win11? How to disable Windows Update from automatically updating drivers in win11? Jun 26, 2024 am 12:18 AM

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

How to disable automatic updates in Win11 How to disable automatic updates in Win11 Dec 27, 2023 pm 12:53 PM

How to disable automatic updates in Win11

Group policy method to turn off automatic updates in win10 Group policy method to turn off automatic updates in win10 Dec 23, 2023 pm 05:07 PM

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 turn off automatic updates when downloading office 2016 - How to turn off automatic updates when downloading office 2016 Mar 04, 2024 pm 04:34 PM

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 to develop a feature that automatically updates a WordPress plugin Sep 05, 2023 am 10:40 AM

How to develop a feature that automatically updates a WordPress plugin

How does Kirin OS provide automatic update and upgrade functions? How does Kirin OS provide automatic update and upgrade functions? Aug 06, 2023 pm 05:49 PM

How does Kirin OS provide automatic update and upgrade functions?

How to turn off automatic updates on Redmi 13c? How to turn off automatic updates on Redmi 13c? Mar 04, 2024 pm 09:49 PM

How to turn off automatic updates on Redmi 13c?

How to cancel automatic updates in win10 safe mode How to cancel automatic updates in win10 safe mode Jan 06, 2024 pm 11:52 PM

How to cancel automatic updates in win10 safe mode

See all articles