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 44A86F39-CFE9-4BEA-834A-B4AC03C827DD@enterprisedb.com
обсуждение исходный текст
Ответ на RE: Logical Replication - Should Destination Table Columns Be Defined With Default Value  (Avi Weinberg <AviW@gilat.com>)
Ответы Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Список pgsql-general

> 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
beupdated when the ALTER TABLE statement is executed. Instead, the default value will be returned the next time the row
isaccessed, 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






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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Следующее
От: Michael Lewis
Дата:
Сообщение: Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value