Real World DBA

Making Life Easier for SQL Server DBAs

Posts Tagged ‘fragmented’

Index Rebuild versus Reorganize: What’s the difference?

Posted by mxhxrdba on February 4, 2008

In a nutshell, you should rebuild when an index is over 30% fragmented and reorganize when an index is between 10% and 30% fragmented. If fragmentation is below 10%, you can probably just leave that index alone. Rebuilding takes more server resources (and uses locks unless you use the ONLINE option available in 2005 Enterprise and Development editions), so reorg when possible. Syntax below to rebuild or reorg all indexes on a table named tTable follows…

REBUILD

ALTER INDEX ALL ON dbo.tTable REBUILD
GO

REORGANIZE

ALTER INDEX ALL ON dbo.tTable REORGANIZE
GO

Posted in Uncategorized | Tagged: , , , , , , , , , , , , , | 1 Comment »