Rebuild indexes in table


Job details

Name: Rebuild indexes in table
Platform: Sqlserver
Category: Maintenance
Premium package: Maintenance package
Description: Rebuilds fragmented indexes in all tables listed in the ‘table list’ parameter.
Long description: Rebuilds fragmented indexes in all tables listed in ‘table list’ parameter.
Version: 1.3
Default schedule: 5 22 6 *
Requires engine install: Yes
Compatibility tag: .[type=‘instance’ & databasetype=‘sqlserver’]/instance[maj_version > ‘2005′ & hasengine=‘YES’ & eng_inst_priv = 0 & (engine_edition = ‘Microsoft SQL Server’ engine_edition = ‘Azure SQL Managed Instance’)]

Parameters

Name Default value Description
keep data for 180 Number of days to provide statistics for.
minimum fragmentation 30 The minimum fragmentation of the indexes to be rebuild.
fill factor 90 The fill factor value (%). FILLFACTOR option is not allowed when rebuilding a columnstore index and will be ignored.
disable during working hours YES This parameter disables the alert to be scheduled, or to be run manually, during working hours (between 7am and 5pm).
rebuild clustered indexes YES Runs “ALTER INDEXREBUILD …” on clustered indexes.
rebuild non clustered indexes YES Runs “ALTER INDEXREBUILD …” on non clustered indexes.
max elap time 180 The maximum number of minutes before the dbWatch task stops rebuilding the remaining indexes.
continue on next run YES If set to “YES“ (default) the rebuild indexes procedure will continue where it left off.
sort in tempdb ON By setting the parameter value to “ON” you can direct the SQL Server Database Engine to use tempdb to store the intermediate sort results that are used to build the index.
table list List of tables (separated by comma, in format [database].[schema].[table]) where all indexes will be rebuilt. The list can only include a maximum of 10 tables.
online OFF When set to “ON” allows to leave all indexes online and accessible while they are being rebuilt (runs ALTER INDEX … ON … REBUILD WITH (ONLINE=ON)). The online option for index rebuilds is only available in Enterprise edition. For other editions this parameter is ignored.

Job Summary

Job Configuration

Operational Details

Dependency Management

Reporting and Analytics

Tables and Lists Managed by Job

Table/Presentation Title Description
Rebuild job history Captures statistical data regarding the rebuild operations for easy monitoring and future reference.
Table list Lists all tables selected for index rebuilding in the scheduled task runs.
Index list Provides details of specific indexes targeted in each operation, including type and uniqueness.
Rebuild index history Logs detailed results of each rebuild operation, useful for auditing and troubleshooting purposes.

| Not rebuilt index history | Captures logs of indexes that were not rebuilt, including reasons and any associated errors, important for continuous improvement of index management strategies.

Overall, this dbWatch job is an essential component of database maintenance, focusing on ensuring optimal performance through regular management of index fragmentation.