Re: [PATCH] Logical decoding of TRUNCATE

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>, Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Logical decoding of TRUNCATE
Date: 2018-01-26 02:44:53
Message-ID: 7f0589c2-c82e-27f3-9d2c-68c0a1bb0b6e@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 1/24/18 07:53, Petr Jelinek wrote:
> That depends on if we consider this to be part of sequence handling or
> truncate statement replication handling. It's true that if we had
> sequence replication, the restart would get propagated that way anyway.
> OTOH, if we'll want to add option in the future to propagate cascade (to
> any additional tables on downstream), it may need to reset sequences
> which are not even present upstream and as such would not be handled by
> sequence replication.

Logical replication, as it currently is designed, replicates discrete
actions, not commands. A delete command that deletes five rows and
cascades to delete three more rows somewhere else ends up being
replicated as eight changes. So I think a TRUNCATE command that
cascades to four tables and resets six sequences should end up being
replicated as ten changes. (Since we currently don't handle sequences
at all, we'll omit the six sequence changes for now.)

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2018-01-26 09:33:08 Re: Deferrable constraint trigger
Previous Message Stephen Frost 2018-01-26 01:46:48 Re: Sync replication

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2018-01-26 02:50:25 Re: [PATCH][PROPOSAL] Refuse setting toast.* reloptions when TOAST table does not exist
Previous Message Peter Eisentraut 2018-01-26 02:41:25 Re: [HACKERS] Subscription code improvements