Sunday, February 19, 2012

indexes

I am dealing with a database that has not had its indexes worked on in quite some time. Would the size of the db shrink if the indexes were rebuilt and re-organized? Or should the size remain the same?

Depending on the workload and volatility of the tables that the indexes are on, you probably will have quite a bit of internal and external fragmentation on your indexes. Doing an index defrag or rebuild will reduce or eliminate this fragmentation, which will reduce the size used by the indexes and thereby the size of the database somewhat.

Rebuilding the index will do a much better job than index defrag. Setting a lower fill factor when you rebuild the index will help reduce fragmentation in the future, but will make the index larger.

No comments:

Post a Comment