public inbox for [email protected]  
help / color / mirror / Atom feed
From: PG Doc comments form <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: Alter table says rewrite is required for default values on 11.
Date: Tue, 09 Oct 2018 03:40:27 +0000
Message-ID: <[email protected]> (raw)

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/10/static/ddl-alter.html
Description:

https://www.postgresql.org/account/comments/new/11/ddl-alter.html/ 
indicates that the table needs a rewrite when a column with a default value
is added, my understanding of the 11 changes meant that is not true any
longer.  The blog post below supports that unless the feature was disabled
in future.

https://blog.dbi-services.com/postgresql-11-instant-add-column-with-a-non-null-default-value/

The specific bit of "Tip" text is;
---
Adding a column with a default requires updating each row of the table (to
store the new column value). However, if no default is specified, PostgreSQL
is able to avoid the physical update. So if you intend to fill the column
with mostly nondefault values, it's best to add the column with no default,
insert the correct values using UPDATE, and then add any desired default as
described below.


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Alter table says rewrite is required for default values on 11.
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox