michal.jakubeczy
michal.jakubeczy

Reputation: 9469

Reorganize/Rebuild single index vs all table indexes

We are planning to run index rebuild/reorganize on a regular basis in our application.

We are aware that we should reorganize when index fragmentation goes over 5% and rebuild when it is over 30%.

We are just wondering whether we shall reorganize/rebuild:

Which approach do you find better?

Upvotes: 2

Views: 933

Answers (1)

M.Ali
M.Ali

Reputation: 69524

I don't know why SQL Server doesn't have anything inbuilt for such operations, but I have recently used a script written by Ola Hallengren for Index maintenance , and I have to say it is the most beautiful piece of code I have come across and also which is free.

The scripts has some cool features like.

  1. It is compatible with all versions of SQL Server 2005 , 2008 , 2012 , 2014 and 2016.

  2. It reorgs indexes when fragmentation is below 30% else it rebuild the index. You can also change this threshold via parameters.

  3. It checks the SQL Server licences, if Enterprise it will rebuild the index online else it rebuilds it offline.

I mean the list goes on, its definitely worth checking.

You can get the scripts from here SQL Server Index and Statistics Maintenance" by Ola Hallengren"

Upvotes: 2

Related Questions