Problem Statement
Explain index maintenance: fragmentation, page splits, fillfactor, and when to rebuild versus reorganize.
Explanation
Frequent random inserts or deletes fragment leaf pages, causing extra I/O. Page splits occur when an insertion lands in a full page and the engine splits it, which adds log volume and can cascade. Lowering fillfactor leaves free space to absorb new rows in hot ranges and reduces splits.
Reorganize (or REINDEX concurrently) when fragmentation is moderate and uptime matters. Rebuild when fragmentation is severe, statistics are off, or you must change index definition or fillfactor. Schedule maintenance off-peak and monitor write pressure so benefit outweighs the cost.
Code Solution
SolutionRead Only
-- SQL Server examples ALTER INDEX ix ON t REORGANIZE; ALTER INDEX ix ON t REBUILD WITH (FILLFACTOR = 90);
Practice Sets
This question appears in the following practice sets:
