SQL Sentry Fragmentation Manager

Heavily fragmented indexes degrade the performance of your database and the applications running on it. Resolve index fragmentation by reorganizing or rebuilding an index. Fragmentation Manager automatically collects table and index information, analyzes the data, takes the appropriate reorganization or rebuild operations, and then performs post defragmentation analysis.

Fragmentation Manager has a dedicated tab in SQL Sentry, Indexes. The Indexes tab displays index related statistics and charts, from the target level down to the individual index level, giving you a complete view of the fragmentation levels on your server. Having this information allows you to make intelligent decisions about index management in your environment such as when and how to perform defragmentation operations, when to adjust fill factors, or when an index definition should be changed.

Set different schedules for instances and databases down to the individual table or index level, giving you complete granular control over any defragmentation actions. Additionally, set specific schedules for rebuilds or reorganizations explicitly. Several additional settings are available to help you calibrate the actions SentryOne takes, including:

  • The ability to set the scan level or mode that's used to obtain fragmentation statistics.
  • The ability to set minimum and maximum index size thresholds for the collection of fragmentation data.
  • The ability to set reorganization and rebuild fragmentation threshold percentages.
  • All index defragmentation settings work within the normal SentryOne hierarchy meaning that settings can be configured at one level and are automatically inherited by objects below it, allowing for easy automation within your environment.

For a complete explanation of all the available settings, see the Fragmentation Manager Settings section.

Enabling Fragmentation Manager

Enable Fragmentation Manager through the right-click context menu of any instance or by opening the Indexes tab of SQL Sentry and selecting Enable Now. The first time you enable it, the Fragmentation Manager Wizard displays.

SentryOne Indexes tab select Enable Now to open the Fragmentation Manger Wizard

Fragmentation Manager Wizard Options

Collect table and index size informationThe base level of Fragmentation Management. Every 15 minutes SentryOne collects table and index size information for the top 500 indexes in each database.

Note:  Indexes are collected that meet the criteria specified in the  Minimum and Maximum size thresholds, with values ranging from 10 MB to 50,000 MB.

Collect buffer data when buffer size > eight GB

Determines if SentryOne collects buffer data when the buffer size is > eight GB.

See the Database Source setting Collect Buffer Data when Buffer > eight GB description for a complete explanation.

Retain historical data [FM]

Retains table and index historical data.
Analyze fragmentation

SentryOne analyzes index fragmentation statistics based on the schedule you specify on the next screen and displays those statistics on the Indexes tab of SQL Sentry.

The Limited Mode obtains fragmentation statistics. Change the Fragmentation Scanmode after the wizard completes from the Index Defragmentation settings. 

Defragment indexes over specified thresholds [FM]

SentryOne performs defragmentation operations based on the schedule you specify in the next screen.

Selects your desired reorganization and rebuild thresholds for defragmentation operations.

Reanalyze indexes after defragmentationSentryOne reanalyzes fragmentation statistics after any defragmentation operations are performed.

Selecting a Schedule

To select a schedule to be used for analysis and/or defragmentation, choose a pre-existing schedule, or select the New command to create a new schedule.

SentryOne Fragmentation Manager Wizard New Schedule

Select Next to confirm your settings, and then select Finish to complete the Wizard.

SentryOne Fragmentation Manger Wizard Confirm Settings

Fragmentation Manager Related Settings

The following are two groups of settings relevant to Fragmentation Manager:

  • Database Source settings—Used to configure the general collection of table and index information, including size collection thresholds, buffer collection thresholds, and index partition options. 
  • Index Defragmentation settings—Used to configure the defragmentation and analysis operations, including scheduling, setting index reorganization, and rebuild thresholds.

Database Source Settings

SynchronizationDescriptionDefault Value
Inherit From ParentSpecifies whether settings in this group are being inherited. For more information about inheritance, see the hierarchy chart in the Alerting and Response System topic.True
Maximum Rows to SynchronizeMaximum rows of historical event data to collect from this source.5000

General SettingsDescriptionDefault Value
Inherit From ParentSpecifies whether settings in this group are being inherited. For more information about inheritance, see the hierarchy chart in the Alerting and Response System topic.True
Enable Table/Index Data Collection

Specifies whether table and index collection is enabled. When enabled every 15 minutes SentryOne collects table and index size information.

Note:  This setting must be True to perform Analysis operations and Automated Defragmentation operations.

Max Partitions to collect per DatabaseThe maximum number of partitions information that's collected per database.

Note:  Partitions are collected by size. The partitions are ordered by ReservedSpaceMB, that’s using reserved_page_count from sys.dm_db_partition_stats.
Min Index Size (MB) to Collect Fragmentation DataSpecifies how large an index must be before statistics are captured. If you keep the default value of 10 MB, any indexes that are smaller than 10 MB aren't analyzed or considered for defragmentation operations.10 MB
Max Index Size (MB) to Collect Fragmentation DataSets the maximum size an index can be, and still be considered for defragmentation operations.50000 MB
Collect Buffer Data when Buffer > eight GB

Specifies whether to collect buffer data when buffer size is > eight GB.

Collecting detailed buffer information is inherently a low overhead process. However, because it takes approximately one second per GB of buffer, on larger buffers the associated query takes some time to complete, which causes it to appear in Top SQL and/or generate associated alerts.

It's safe to enable this setting because SentryOne ensures that the total time spent per day collecting buffer data is roughly the same regardless of buffer size, and collection only occurs when buffer has changed.

When collecting buffer data, SentryOne uses a variable collection frequency, that's based on the size of the buffer. The following chart shows the variable collection frequency along with the approximate time it takes to collect buffer data for different buffer sizes.

Maximum Buffer Data Collection Frequency


<not specified>

Set with Wizard

Index Defragmentation Settings

After you enable Fragmentation Manager the Index Defragmentation settings are accessed through the Settings pane. Index Defragmentation settings are configured at the following levels: global (All Targets), sites, target group, target, instance, database, table, or at the individual index.

To configure the Index Defragmentation settings for a specific instance, complete the following steps:

  1. Select the instance in the Navigator (View > Navigator), and then open the Settings pane (View > Settings).
    SentryOne select the desired node in the Navigator and then open the Settings pane
  2. Select Index Defragmentation from the bottom drop-down menu to configure your settings.
    SentryOne Settings pane Index Defragmentation Settings

Index Defragmentation Settings 

General Defrag SettingsDescriptionDefault Value
Inherit From ParentSpecifies whether settings in this group are being inherited. For more information about inheritance, see the hierarchy chart in the Alerting and Response System topic.False
Primary ScheduleThe schedule where index analysis and/or defrag performs, according to the configured reorg and rebuild thresholds. For more information about schedules, see the Schedules topic.

<not specified>

Set with Wizard

Operation TypeSpecifies whether analysis only or analysis and defrag operations occur under the Primary schedule.Analyze Only
Reanalyze Indexes after DefragSpecifies whether to run the fragmentation analysis again after any scheduled defrag.False
Fragmentation Scan ModeThe Scan mode used for obtaining fragmentation statistics.                         
  • Limited mode is the fastest mode and scans the smallest number of pages. For an index, only the parent-level pages of the B-tree are scanned. For a heap, only the associated PFS and IAM pages are examined; the data pages of the heap aren't scanned.
  • Sample mode returns statistics based on a one percent sample of all the pages in the index or heap. If the index or heap has fewer than 10,000 pages, Detail mode is used instead of Sample mode.
  • Detail mode scans all pages and returns all statistics.

For more information about Scan modes, see the sys.dm_db_index_physical_stats (Transact-SQL) MSDN article.

Maximum Concurrent Operations Specifies the maximum number of concurrent operations. Operations are defined as an analysis, rebuild, or reorganization.  This setting is capped at five.one
Delay Between Defrag OperationsWhen Maximum Concurrent operations is set to one, specify a delay between defrag operations to prevent send/redo queue overload when availability groups or mirroring are in use.30 seconds
Maximum Duration

This sets the maximum allowed runtime for the defragmentation process.

If the maximum duration is met during a rebuild operation the rebuild still completes. If the maximum duration is met during a reorganization operation, the reorganization stops and starts again during the next scheduled cycle.

two hours

Partitions to include in the rebuild. This option is applicable for indexes that have a sliding windows partition scheme. For more information about partition schemes, see the Implementing Partitioned Tables and Indexes MSDN article.

  • All —All partitions belonging to the index that meet the defragmentation criteria are either rebuilt or reorganized.
  • Max Only —If the maximum numbered partition of the index meets the defragmentation criteria it's rebuilt or reorganized.
  • Exclude Max —All partitions that meet the defragmentation criteria, excluding the maximum numbered partition, are either rebuilt or reorganized.

Note:  : Online rebuilds for partitioned indexes only perform if the Partitions setting is set to All and all partitions in the index meet the defragmentation criteria. If the above criteria isn't met, an Offline Rebuild performs instead.

All Partitions
Index Reorg SettingsDescriptionDefault Value
Inherit From ParentSpecifies whether settings in this group are inherited. For more information about inheritance, see the hierarchy chart in the Alerting and Response System topic.True
Reorg Threshold%Sets the fragmentation threshold percent at which indexes are reorganized. If the default threshold of 10 percent is kept, indexes that have an index fragmentation percentage below 10 percent , as determined during the Fragmentation Scan, aren't reorganized. Indexes with a fragmentation percent exceeding 10 percent are reorganized. For more information about reorganizing indexes, see the Reorganizing and Rebuilding Indexes MSDN article.10 percent
Reorg ScheduleDedicated schedule where reorgs only are performed, according to the reorg threshold. Rebuilds aren't performed even if the rebuild threshold has been exceeded, and are reorganized.<not specified>
Index Rebuild SettingsDescriptionDefault Value
Inherit From ParentSpecifies whether settings in this group are inherited. For more information about inheritance, see the hierarchy chart in the Alerting and Response System topic.True
Rebuild Threshold %Sets the fragmentation threshold percent for the indexes that are rebuilt. If the default value of 30 percent is kept, only indexes that have an index fragmentation percent of 30 percent or greater, as determined during the Fragmentation Scan are rebuilt. For more information about rebuilding indexes, see the Reorganizing and Rebuilding Indexes MSDN article.30 percent
Rebuild ScheduleDedicated schedule where rebuilds only (online or offline) are performed, according to the rebuild threshold.<not specified>
Offline Rebuild WindowIf an offline rebuild performs, it starts the offline rebuild during the specified window.<not specified>
Sort in tempdbSpecifies if tempdb is to be used for sorting during rebuild operations. For more information about tempdb and index creation, see the tempdb and Index Creation MSDN article.False
Use Online Rebuild (Enterprise Only)Determines if the index rebuild operations perform online. For more information about performing index operations online, see the Performing Index Operations Online MSDN article.True
MAXDOP (Enterprise Only)

Determines the max degree of parallelism (MAXDOP) that's used when rebuilding the index. The default value is zero, which allows the server to determine the number of CPUs that are used. For more information about configuring Parallel Index Operations, see  the Configuring Parallel Index Operations MSDN article.

Note:  When Fragmentation Manager is working on an index, it uses the MaxDOP to determine how parallel each concurrent connection can run. Increasing the Concurrent Connections increases how many indexes are being worked by the tool at any given time. 


Note:  Indexes that can't be rebuilt online, such as those with LOB columns, are never defragmented by a Rebuild schedule if Use Online Rebuild is set to True except within a specified Offline Rebuild Window. Otherwise, they are only analyzed.

Note:  When there are multiple partitions, Fragmentation Manager works on one partition at a time in a serial fashion. Parallelize the Index analysis and defragmentation in Fragmentation Manager by using one of the following methods: 

Manual Fragmentation Operations

Fragmentation Operations can also be initiated manually. Within the Navigator use the right-click context menu of any database, table, or index to initiate fragmentation operations, including analysis, reorganizations, or rebuilds.

Manual Fragmentation Operations can also be initiated within the Indexes tab. From the Grid/Tree view found in the center of the screen, use the context menu of any database, table, or index to access fragmentation operations.

Fragmentation Alert Conditions

The following fragmentation related conditions are available to configure actions for:

  • Defragmentation Completed
  • Defragmentation Started
  • Defragmentation Failure

To configure a fragmentation related condition, complete the following steps: 

  1. Select the node appropriate to the level you'd like to configure the action for in the Navigator pane (View > Navigator), and then open the General Conditions section in the Conditions pane (View > Conditions).
    SentryOne Conditions pane General Conditions for desired node
  2. Select Add in the Conditions pane to open the Actions Selector window.
    SentryOne Actions Selector: General Conditions
  3. Expand the Index actions and then the appropriate condition. Use the check box(s) to select which actions should be taken in response to this condition being met. Select OK to save your setting.
    SentryOne Actions Selector: General Conditions: Index: Defragmentation Failure

For more information about actions that can be taken when a condition is met, see the Actions topic.

Indexes Tab

SentryOne Indexes tab

For more information about the charts and statistics displayed in the Indexes tab, see the Indexes topic. 

Database Space Usage Band

By enabling the Fragmentation Manager, the functionality of the Disk Space tab is also enhanced by providing additional information regarding the space usage of indexes. For more information, see the Disk Space topic.

Buffer Size (GB)Collection Frequency (Min)Time to Collect (Sec)Time to Collect (Min)