eG Monitoring
 

Measures reported by MsSqlIndexFragTest

Fragmentation exists when indexes have pages in which the logical ordering, based on the key value, does not match the physical ordering inside the data file. All leaf pages of an index contain pointers to the next and the previous pages in the index. This forms a doubly linked list of all index/data pages. Ideally, the physical order of the pages in the data file should match the logical ordering. Overall disk throughput is increased significantly when the physical ordering matches the logical ordering of the data. This leads to much better performance for certain types of queries. When the physical ordering does not match the logical ordering, disk throughput can become less efficient, because the disk head must move back and forth to gather the index pages instead of scanning forward in one direction. This is how fragmentation affects I/O performance.

The first step to resolving the performance threat posed by fragmented indexes is to identify which indexes are fragmented. The MsSqlIndexFragTest helps in this regard. This test scans the indexes on an MS SQL server for high and very high levels of fragmentation based on configured thresholds, and reports the count of fragmented indexes. Using the detailed diagnosis capability of the test, you can also quickly drill down to the specific indexes that have been fragmented. You can thus proceed to defragment/rebuild the affected indexes, so as to increase disk throughput and improve overall SQL performance.

The measures made by this test are as follows:

Measurement Description Measurement Unit Interpretation
H_FRAGMENT Indicates the number of highly fragmented indexes in this database. Number This measure returns the number of indexes that have touched/crossed the HIGHFRAGMENTLIMIT, but fall short of the configured VERYHIGHFRAGMENTLIMIT.

Ideally, the value of this measure should be 0. A high value indicates high index fragmentation. High levels of fragmentation can cause disk I/O to mount, queries to run for long periods, and the overall performance of the database server to deteriorate.

Use the detailed diagnosis of this measure to identify highly fragmented indexes.

Once the affected indexes are isolated, take the necessary steps to correct the fragmentation. Towards this end, SQL provides the following statements:

  • DROP INDEX followed by CREATE INDEX
  • CREATE INDEX WITH DROP_EXISTING
  • DBCC INDEXDEFRAG
  • DBCC DBREINDEX
VH_FRAGMENT Indicates the number of very highly fragmented indexes in this database. Number This measure returns the number of indexes that have touched or violated the VERYHIGHFRAGMENTLIMIT configured for this test.

Ideally, the value of this measure should be 0. This measure returns the number of indexes that have touched/crossed the HIGHFRAGMENTLIMIT, but fall short of the configured VERYHIGHFRAGMENTLIMIT. A high value indicates high index fragmentation. High levels of fragmentation can cause disk I/O to mount, queries to run for long periods, and the overall performance of the database server to deteriorate.

Use the detailed diagnosis of this measure to identify highly fragmented indexes.

Once the affected indexes are isolated, take the necessary steps to correct the fragmentation. Towards this end, SQL provides the following statements:

  • DROP INDEX followed by CREATE INDEX
  • CREATE INDEX WITH DROP_EXISTING
  • DBCC INDEXDEFRAG
  • DBCC DBREINDEX