Have a 3 part composite key Int, Int, Int on a large table
Insert speed degrades due to fragmentation
PK1 does not fragment (inserts are in order and never revised)
But PK2,and PK3 fragment badly and quickly
What strategy should I use for index maintenance?
Is there a way to Rebuild the index with?
PK1 fill factor 100
PK2 fill factor 10
PK3 fill factor 10
No – it’s ONE index – you cannot have different fill factors on the columns of a single index … the index structure is made up of entries of
(PK1, PK2, PK3)and this tuple combined is stored on the pages. You can only set fill factors for the index/page – not for individual parts of a compound index.My typical approach would be to use something like 70% or 80% on an index I suspect of fragmentation, and then just observe. See how fast and how badly it fragments. If it’s unbearable later in the day – lower the fill factor even more. Typically, with a 70-80% fill factor, you should be fine during the day, and if you rebuild those critical indexes every night, your system should work fine.