In our previous blog post, we got to know, how to find out all fragmented indexes in a database. Now we will see how to defrag indexes.
According to Microsoft guidelines, based upon index fragmentation percentage, we may choose to either REORGANIZE, REBUILD indexes or just ignore. Here are the MS guidelines.
Let’s say N = fragmentation percentage
N <= 5 – IGNORE
5 < N < 30 – REORGANIZE
N > 30 – REBUILD
Reorganize a fragmented index