Explanation of Find Fill Factor of All Indexes in a Database in SQL Server
Fill Factor is a setting that determines how much space to leave in each index page when an index is created or rebuilt. It affects performance, especially in systems with frequent INSERT
or UPDATE
operations.
A Fill Factor of:
100 means pages are fully filled (best for read-heavy tables).
Less than 100 leaves space to reduce page splits (good for write-heavy tables).
You can use a script to list the Fill Factor of all indexes in a database.
- SELECT
- OBJECT_SCHEMA_NAME(i.object_id) AS SchemaName,
- OBJECT_NAME(i.object_id) AS TableName,
- i.name AS IndexName,
- i.index_id,
- i.fill_factor
- FROM
- sys.indexes i
- WHERE
- i.type IN (1, 2) -- clustered and non-clustered
- AND OBJECTPROPERTY(i.object_id, 'IsUserTable') = 1
- ORDER BY
- SchemaName, TableName, IndexName;
Conclusion:
Knowing the Fill Factor of indexes helps in fine-tuning database performance. This script gives a clear view of how your indexes are configured so you can decide if adjustments are needed—especially for write-heavy or fragmented tables.
Post Comment
Your email address will not be published. Required fields are marked *