SQL Server basic algorithm for automatically updating statistics

Source: Internet
Author: User

Basic information for automatically updating statistics Algorithm Yes:

· If the base number of the table in the tempdb database is less than 6, each of the six modifications will be automatically updated to the table.
· If the base number of a table is greater than 6 but less than or equal to 500, the update status is changed every 500.
· If the base number is greater than 500, when the table is updating statistics (500 + 20% tables), it is changed.
· Changing the base of a table variable does not trigger automatic update of statistics.

Note: strictly speaking, SQL Server calculates the base number as the number of rows in the table.

Note: In addition to the base, the selectivity of This predicate also affects autostats generation. This means that this statistical information may not be updated. For afer, the base number for each 500 modification is <500 or the base number for each 20% change seems to be> 500. Proportional factors (values range from 1 to 4, 1 and 4) are generated based on selectivity, this factor changes the actual number of modifications required to generate the product autostats of the number obtained from the algorithm.

In the form of a table, the algorithm above summarised can be used:
_________________________________________________________________________________
Table type | empty condition | threshold whenempty | threshold when not empty
_________________________________________________________________________________
Permanent | <500 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.
___________________________________________________________________________

Author: smithliu328

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.