Changing fillfactor of existing table

15.4k Views Asked by At

Is it possible to change fillfactor of an existing table in PostgreSQL 8.4?

Or do I have to create copy of a table with new fillfactor - which is not the best approach because of foreign key problems?

2

There are 2 best solutions below

7
On BEST ANSWER

Yes, that's possible. But you have to VACUUM FULL or CLUSTER this table afterwards to rewrite the table.

ALTER TABLE foo SET ( fillfactor = 50);
VACUUM FULL foo;
1
On
ALTER TABLE foo SET ( fillfactor = 20);
VACUUM FULL foo;

View table options incl. fill factors

select t.relname as table_name, 
       t.reloptions
from pg_class t
  join pg_namespace n on n.oid = t.relnamespace
where n.nspname = 'jxy'
  and t.relname in ('xx', '')
;

Then

run pg_repack