Course contentsShow
← Databases & SQL
Lesson 659 of 1,9536. Query Performance and IndexingFree lesson

Fill Factor vs Page Free Space

Calculate the optimal buffer space for index pages to handle varying update frequencies.

In this lesson, you will learn how to calculate the optimal buffer space for index pages to balance storage efficiency against the performance cost of page splits during frequent updates.

The Balancing Act of Page Density

When we create an index, the database engine packs data into fixed-size containers called "pages." By default, the engine tries to fill these pages as much as possible (often 100%) to save disk space. However, if your application frequently performs INSERT or UPDATE operations that add new rows into the middle of an existing index, a full page has no "breathing room."

When a new row needs to fit into a full page, the database is forced to perform a page split: it creates a new page, moves half of the existing data over, and inserts the new record. This is a costly operation that increases I/O and can cause fragmentation.

Calculating Your "Breathing Room" (Fill Factor)

The FILLFACTOR setting tells the engine how much of each page to leave empty for future data. Setting a fill factor of 80% means each page is only 80% full at the time of creation, leaving 20% of the page free for incoming updates.

To calculate the appropriate buffer for your specific workload, consider the update frequency:

  • Read-heavy / Static data: Set the FILLFACTOR to 90–100%. You want high density to minimize the number of pages the engine must scan.
  • Moderate updates: Use 80–85%. This provides a buffer for routine growth.
  • High-frequency inserts: Use 60–70%. By leaving more space (30-40% free), you drastically reduce the frequency of page splits for volatile data.

For example, if you are indexing a CreatedDate column where new records are constantly appended, you might configure it like this:

CREATE INDEX IX_Orders_Date 
ON Orders(CreatedDate) 
WITH (FILLFACTOR = 70);

By leaving 30% of each page empty, you ensure that new records are inserted into existing pages rather than triggering a cascade of expensive page splits across the B-Tree structure. Remember: while a lower fill factor consumes more disk space, it prevents the significant performance degradation caused by constant structural index reorganizations.

Key Takeaway: The Fill Factor is a strategic trade-off where you sacrifice storage density to provide "buffer space" that minimizes expensive page splits during high-frequency write operations.