DBCC INDEXDEFRAG:
Usage:
To defragment indexes in the database, we can use the DBCC INDEXDEFRAG command. Actually, when we fire the DBCC INDEXDEFRAG command in SQL Server, it runs & tries to reduce fragmentation and enhance the performance of the query. Also tries to reorganize all pages of clustered and non-clustered indexes which are available at leaf-level.
Example:
DBCC INDEXDEFRAG('<DatabaseName>,<TableName>,<IndexName>')
DBCC INDEXDEFRAG('AdventureWorksDW2016','DimSalesTerritory','AK_SalesTerritory')
Benefits:
It reduces fragmentation & improves the performance of the TSQL queries.
It also minimizes IO operation.