FILLFACTOR
FILLFACTOR is a SQL Server configuration setting that determines the amount of free space left on a page in percent after data is inserted during the index creation or reorganization. Beneficial in reducing page splits by modifying the density of the index pages, it directly influences the index's performance and maintenance needs. The FILLFACTOR value ranges from 1 to 100; a higher value leads to less empty space and effectively a denser index, while a lower value leads to more empty space and potentially less page splits.
Example
Output
Explanation
In the above example, a table test_table
is created with two columns ID
and Data
. By specifying WITH (FILLFACTOR = 70)
, the table is set to leave 30% of each block empty for future updates and inserts under the same database block, resulting in less page splits. Five rows of data are inserted into the table. The final command SHOW (pg_total_relation_size('test_table'))
shows the total disk space occupied by the test_table
table in bytes.
Example
Output
Explanation
The FILLFACTOR option determines the percentage of space on each leaf-level page that is to be filled with data, reserving the rest as a free space for future growth. In this example, a clustered index is created on the “Employees” table on the “Name” column with a fill factor value of 80, meaning each page in this index will be filled with 80% data, reserving 20% for future data growth.
Example
Output
Explanation
The FILLFACTOR is used to leave a certain percentage of each data block empty so that when new rows are inserted, they can be placed on the same data block(s). In this case, FILLFACTOR is set to 70 which means that 70% of each data block will be filled with data, leaving 30% of each data block free to accommodate future data.