开发者

Changing fillfactor of existing table

开发者 https://www.devze.com 2023-01-24 11:23 出处:网络
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 fore

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?


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;


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
0

精彩评论

暂无评论...
验证码 换一张
取 消