PostgreSQL Fill-Factor – Best Practices for Fixed-Width Columns

fill-factorpostgresql

We have a table where we are planning to update timestamp fields only.

In the first import these columns will be nulls then we will update them as the computation finished on these rows.

The question is; should we set a fill-factor lower than 100 for this table or PostgreSQL will allocate a fixed size for these columns so lowering the fill-factor makes no sense?

Best Answer

PostgreSQL never does in-place updates of the data, so it doesn't matter whether the records are fixed width or not when deciding whether the fillfactor should be 100. It always has to find new space for the new data, even if the new data is the same width or narrow than the old data. And if you set the fillfactor to 100 that new space will usually have to be in a different block.

Once you decide you do want to lower the fillfactor, then the fact that the width of the tuples will increase as you fill them out does mean you should lower it by more than you otherwise would.