I've been digging around without any luck.
SQL Server 2008: Is it possible to adjust the fill factor on a specific clustered index/table without having to rebuild the entire table?
For example, if it has 400 million records, can we adjust the fill factor and have SQL Server use the new fill factor on all pages that haven't already exceeded that limit (as well as new splits), and then adjust pages that are over limit during index maintenance?
Is it possible to pre-define the fill-factor that an index should be built to during the next index maintenance?
Best Answer
This is not how
FILLFACTOR
works. It only applies to pages written during aCREATE
orREBUILD
operations. Pages are always filled as much as possible as they are created or split.As per the MSDN documentation for CREATE INDEX:
So, even if you change the
FILLFACTOR
during aREBUILD
(since your Clustered Index already exists), only the existing pages will make use of that value. As new pages are created, and existing pages are split, they will be filled as if theFILLFACTOR
were set to100
.Or, stated another way: the rebuild operation is not your problem here as you will never get new and split pages to use a
FILLFACTOR
below100
.Also: No, it is not possible to "pre-define" a change to the
FILLFACTOR
value that will take affect the next time there is aREBUILD
. It can only be specified in theWITH
clause of aREBUILD
operation. BUT, once you have applied the new value during a rebuild, that new value will be stored insys.indexes
and will be used again for subsequent rebuilds unless it is changed again by someone specifyingWITH (FILLFACTOR = x)
.Or, again stated another way:
FILLFACTOR
value can be changed only when actually doing aREBUILD
(I am not considering aDROP
and re-CREATE
of an Index to be a "change").The
FILLFACTOR
value is used only byCREATE INDEX
andALTER INDEX ... REBUILD
(and technically alsoDBCC DBREINDEX
, but that shouldn't be used as it has been deprecated as of SQL Server 2005);FILLFACTOR
is not used as rows are inserted or updated as that would defeat the purpose of having this option in the first place.FILLFACTOR
reserves space on existing data pages so that the space can be used (hence reducing the chances of getting page splits); not allowing pages to fill beyond theFILLFACTOR
value would permanently reserve that space for no purpose, effectively reducing the size of the data pages, which would actually increase, not decrease, the chances of getting page splits.Page split operations always move approximately 50% to the new page.