How to reorganize a SQL Server index?

How to reorganize a SQL Server index? This operation defragments the lower level of the indexes by reordering the pages physically, from left to right. The reorganize operation also compacts the pages of the index. To better understand this, imagine a book of recipes with the pages not ordered anymore. Then you must reorganize the pages in order to reach the desired page quickly.

How to reorganize a fragmented SQL Server index to optimize the performance of a query?

Let’s consider the index created in this article. The index is using the main filters on the sales table from the time dimension, i.e. the year and month columns.


This article shows how to reorganize a fragmented index with a simple example. To go further check the official documentation on why to check index fragmentation and how to rebuild and reorganize indexes.