How to create statistics on SQL Server

Source: Internet
Author: User

A few days ago, I saw someone asking why I couldn't see SQL server statistics on a table. This table is a newly created heap table with no indexes and has never been accessed. To answer this question, we need to go back to how SQL Server creates and maintains statistics.

 

SQL Server creates statistics in the following three cases:

 

1. When an index is created, SQL Server automatically creates statistics on the column where the index is located.

 

2. When SQL Server wants to use the statistical information of some cases, it will automatically create the statistical information if no statistical information is found (the premise is to enable automatic statistical information)

 

3. You can use create statistics to manually create statistics.

 

For more information, refer to the two articles.Article:

Understandingsql server statistics

Sqlserver statistics 

 

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.