SQL Server rebuilds indexes before and after comparison

Source: Internet
Author: User

In the maintenance project, we often encounter problems with index maintenance, through the statement, we can determine whether the index of a table needs to be rebuilt.

Execute the statement: Parse the index of the table first

Index establishment of the analysis table: DBCC showcontig (' table ')
DBCC showcontig is scanning ' table ' tables ... Table: ' Table ' (53575229); index id:1, database id:14 has performed a Table-level scan. -Scan pages .....: 228-Number of scanned areas .....: 52-zone switching times...............---------------# # # # # # # .....................: 225-average number of pages per zone ....: 4.4-Scan density [best count: Actual Count] ...: 12.83% [29:226]-(in)--------- Logical scan fragment ...........: 97.37%-zone Scan fragment ....: 98.08%-The average Available bytes per page ...: 2686.3-Avg.-Page density (PP))... £ º (average) of the pages in the same area ..... (full) .....: 66.81%.... £ º (a)

When you find that the scan density line, the ratio of the best count to the actual count has been severely misaligned, the logical scan fragments accounted for a very large percentage of the average available bytes per page is very large, indicating

Your index needs to be re-organized.

Perform the Rebuild Index command: Post analysis after DBCC dbreindex (' Table ')
DBCC showcontig is scanning ' table ' tables ... Table: ' Table ' (53575229); index id:1, database id:14 has performed a Table-level scan. -Scan pages .....: 154-Number of scanned areas .....: 20-zone switching times...............---------------# # # # # # # .....................: 19-average number of pages per zone ....: 7.7-Scan Density [best count: Actual Count] ...: 100% [20:20]-logos, and so on ......----- Scan fragments ............: 0%-zone Scan fragment ....: 55%-The average Available bytes per page ...: 86.8-Average page density (full). \ \ \ \ \ \ \ \ \ \ \ (+/-) '. * * * * * *. ..........: 98.93%.

SQL Server rebuilds indexes before and after comparison

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.