Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value

Поиск
Список
Период
Сортировка
От Mark Dilger
Тема Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Дата
Msg-id 7E725C6A-CC72-41E9-B9E8-D55B7F5E63C3@enterprisedb.com
обсуждение исходный текст
Ответ на Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value  (Michael Lewis <mlewis@entrata.com>)
Список pgsql-general

> On Nov 9, 2021, at 1:24 PM, Michael Lewis <mlewis@entrata.com> wrote:
>
> Is there any advantage to not defining the default on the replica? If it is not a static value and the publishing
databasewill trigger row updates, I could see waiting to set the default until after the table re-write is done, but
otherwisethere 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
expectthat the DDL executed on the publisher (such as the ALTER TABLE..ADD COLUMN..DEFAULT..) would be the same as that
executedon 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






В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Lewis
Дата:
Сообщение: Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Следующее
От: SQL Padawan
Дата:
Сообщение: Understanding the differences between Temporal tables, CDC and Time Series.