Fill Factor — Complete Guide
Fill Factor — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of SQL Server Tutorial on Toolliyo Academy.
On this page
SQL Server Tutorial · Lesson 37 of 100
Fill Factor
SQL basics ✓ → Queries → Advanced
Queries · 2 — JOINs · ~6 min · SQL — Indexing & Performance
What is this?
Fill factor leaves free space on index pages at rebuild time so later inserts cause fewer page splits. 100 means pack full; lower values leave room.
Why should you care?
Random inserts into the middle of an index (GUID keys) cause splits and fragmentation — fill factor can reduce how often that hurts.
See it live — copy this example
Run in SQL Server Management Studio (SSMS) or Azure Data Studio.
USE DataVerse;
ALTER INDEX IX_Orders_CustomerId ON dbo.Orders
REBUILD WITH (FILLFACTOR = 90);
SELECT i.name, i.fill_factor
FROM sys.indexes i
WHERE i.object_id = OBJECT_ID(N'dbo.Orders') AND i.name = N'IX_Orders_CustomerId';
What happened?
- REBUILD applies fill factor 90 to that index.
- sys.indexes confirms the setting.
- Sequential IDENTITY keys often keep fill factor near 100.
Practice next
- Rebuild one NC index with FILLFACTOR = 90.
- Confirm fill_factor in sys.indexes.
- Note: fill factor applies on rebuild, not magically to new pages forever without maintenance.
- Rebuild with FILLFACTOR = 100 for a sequential key index.
- Compare fragmentation before/after heavy inserts (lab only).
Remember
Fill factor reserves page free space. Apply on CREATE/REBUILD. Tune for insert patterns, not superstition.
GUID-heavy index maintenance
A legacy DataVerse table clustered on NEWID().
Outcome: Ops uses lower fill factor + scheduled rebuilds until they migrate keys.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!