Basic algorithms for SQL Server to automatically update STATISTICS _mssql
Source: Internet
Author: User
The basic algorithm for automatically updating statistics is:
· If the table is in the tempdb database table the cardinality is less than 6, automatically updated to the table for each of the six modifications.
· If the base of the table is greater than 6, but less than or equal to 500, update the status every 500 of the modifications.
· If the cardinality is greater than 500, the table changes when the statistics are updated (tables of 500 + 20%).
· Changes to the cardinality of a table variable do not trigger automatic UPDATE statistics.
Note: In this strict sense, SQL Server calculates the cardinality as the number of rows in the table.
Note: In addition to cardinality, the selectivity of the predicate can also affect autostats generation. This means that the statistics may not be updated by the Afer per 500 modification cardinality is < 500 or the base of each 20% change is like > 500. Scaling factor (the range of values from 1 to 4, 1, and 4) is generated on the basis of selectivity, the change of this factor autostats the actual number of changes required by the product of the number obtained by the algorithm.
In the form of a table, you can summarised the above algorithm:
_________________________________________________________________________________
Table Type | Empty Condition | Threshold Whenempty | Threshold When not Empty
_________________________________________________________________________________
Permanent | < rows | # ofchanges >= 500 | # of Changes >=500 + (20% of cardinality)
___________________________________________________________________________
Temporary | < 6 rows | # Ofchanges >= 6 | # of Changes >=500 + (20% of cardinality)
___________________________________________________________________________
Table
Variables | Change in cardinality does not affectautostats generation.
___________________________________________________________________________
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.