How to decide the value of the FILLFACTOR?

~ 0 min
2016-03-04 11:14

Deciding appropriate FILLFACTOR is very case-dependent. Here are some rules of thumb.

If a table fits one of the following criteria,  

set a larger FILLFACTOR for it:

1. The table rarely updates.

2. The record size is mostly fixed, ie, all columns are mostly fixed-length and not null. The FILLFACTOR of a table with fixed-size records can be set to 100.

3. Neither of above, but the frequently updated columns are largely fixed-length.

 

Here are the steps to estimate the lower bound. But please note that the calculation of actual usage of pages could become very complicated. The method provided here is to give a quick and effective way to estimate a range:

1. Calculate the record size Empty with all nullable columns null and variable-length columns empty.

2. Calculate the record size Full with all columns filled and in full length.

3. Then the FILLFACTORr should not be smaller than max(50, Empty/Full*100 )

For most cases the ideal FILLFACTOR will fall in between this value and 100, and you should be able to narrow down the range by calculating Empty depending on the real case. For example:

table1 {

     c1 int not null;

     c2 int;

     c3 char(20) not null;

     c4 varchar(12) not null;

}

In this case, Empty = 4 + 0 + 20 + 0 = 24, Full = 4 + 4 + 20 + 12 = 40, so the FILLFCATOR should be at least 24/40*100 = 60.

However, if c4 is restricted by AP to at least six characters (for instance, password), Empty should be 4 + 0 + 20 + 6 = 30, and the FILLFACTOR be not smaller than 30/40*100 = 75.

 

For BLOB/CLOB columns, use 8 bytes (size of OID) as their size.

Average rating 0 (0 Votes)

You cannot comment on this entry

Tags