pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Dilger <mark.dilger@enterprisedb.com>
To: Avi Weinberg <AviW@gilat.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Date: Tue, 9 Nov 2021 08:07:47 -0800
Message-ID: <44A86F39-CFE9-4BEA-834A-B4AC03C827DD@enterprisedb.com> (raw)
In-Reply-To: <DB9PR07MB71802D47D944DAA9A8AB688FCB929@DB9PR07MB7180.eurprd07.prod.outlook.com>
References: <DB9PR07MB718063C946C14D4A6EEDA24DCB929@DB9PR07MB7180.eurprd07.prod.outlook.com>
	<CAKFQuwaTLveZQjeo+yPMkWBM=J_2rW5Z120ZdMGHiCVW=bUW0g@mail.gmail.com>
	<DB9PR07MB71802D47D944DAA9A8AB688FCB929@DB9PR07MB7180.eurprd07.prod.outlook.com>



> On Nov 9, 2021, at 8:02 AM, Avi Weinberg <AviW@gilat.com> wrote:
> 
> 	• A third column is added to table with default value on publisher side, but without default value on subscriber side
> 	• The default value column has value for existing rows on publisher, but null on the subscriber side. 

See https://www.postgresql.org/docs/14/ddl-alter.html#DDL-ALTER-ADDING-A-COLUMN

The important part is this TIP:

From PostgreSQL 11, adding a column with a constant default value no longer means that each row of the table needs to be updated when the ALTER TABLE statement is executed. Instead, the default value will be returned the next time the row is accessed, and applied when the table is rewritten, making the ALTER TABLE very fast even on large tables.

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company








view thread (7+ messages)  latest in thread

Message-ID: <44A86F39-CFE9-4BEA-834A-B4AC03C827DD@enterprisedb.com>
Permalink:  ../44A86F39-CFE9-4BEA-834A-B4AC03C827DD@enterprisedb.com/
Also on:    postgresql.org/message-id/44A86F39-CFE9-4BEA-834A-B4AC03C827DD@enterprisedb.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: mark.dilger@enterprisedb.com, AviW@gilat.com, david.g.johnston@gmail.com
  Subject: Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value
  In-Reply-To: <44A86F39-CFE9-4BEA-834A-B4AC03C827DD@enterprisedb.com>
  References: <DB9PR07MB718063C946C14D4A6EEDA24DCB929@DB9PR07MB7180.eurprd07.prod.outlook.com> <CAKFQuwaTLveZQjeo+yPMkWBM=J_2rW5Z120ZdMGHiCVW=bUW0g@mail.gmail.com> <DB9PR07MB71802D47D944DAA9A8AB688FCB929@DB9PR07MB7180.eurprd07.prod.outlook.com> <44A86F39-CFE9-4BEA-834A-B4AC03C827DD@enterprisedb.com>

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

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