From: | Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> |
---|---|
To: | Michael Lewis <mlewis(at)entrata(dot)com> |
Cc: | Avi Weinberg <aviw(at)gilat(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value |
Date: | 2021-11-09 21:43:54 |
Message-ID: | 7E725C6A-CC72-41E9-B9E8-D55B7F5E63C3@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> On Nov 9, 2021, at 1:24 PM, Michael Lewis <mlewis(at)entrata(dot)com> wrote:
>
> Is there any advantage to not defining the default on the replica? If it is not a static value and the publishing database will trigger row updates, I could see waiting to set the default until after the table re-write is done, but otherwise there doesn't seem to be any benefit to skipping column defaults on subscribers.
That's a schema design decision. I can't really make recommendations in the abstract. As a general rule, I would expect that the DDL executed on the publisher (such as the ALTER TABLE..ADD COLUMN..DEFAULT..) would be the same as that executed on the subscriber, unless there is a particular reason to want different behavior on the subscriber.
Wanting different behavior is not unreasonable. For example, if the subscriber exists merely to archive data from the publisher, the subscriber might not bother creating indexes over that data, even if such indexes exist on the publisher.
—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | SQL Padawan | 2021-11-10 06:43:01 | Understanding the differences between Temporal tables, CDC and Time Series. |
Previous Message | Michael Lewis | 2021-11-09 21:24:00 | Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value |