ALTER TABLE and vacuum

Started by Rick Widmeralmost 10 years ago2 messagesgeneral
Jump to latest
#1Rick Widmer
pgsql@rickwidmer.com

Do I need to vacuum after an alter table command?

Does it matter if there is a default or if we accept NULLs for the new
field?

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Vik Fearing
vik@postgresfriends.org
In reply to: Rick Widmer (#1)
Re: ALTER TABLE and vacuum

On 06/06/16 10:55, Rick Widmer wrote:

Do I need to vacuum after an alter table command?

If the specific command you do rewrites the table, you absolutely should
vacuum in order to restore the visibility map. Otherwise, it not necessary.

Does it matter if there is a default or if we accept NULLs for the new
field?

Yes, that makes a difference. If you add a column that defaults to
NULL, the table will not be rewritten.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general