Re: [PATCH] Logical decoding of TRUNCATE - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: [PATCH] Logical decoding of TRUNCATE
Date
Msg-id CANP8+jLMet1MHkYP2no9Wrn5RCiCJvFsF+ie-YUDk2nfXCnjRw@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Logical decoding of TRUNCATE  (Andres Freund <andres@anarazel.de>)
Responses Re: [PATCH] Logical decoding of TRUNCATE  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 1 April 2018 at 21:01, Andres Freund <andres@anarazel.de> wrote:

>> ***************
>> *** 111,116 **** CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
>> --- 111,121 ----
>>             and so the default value for this option is
>>             <literal>'insert, update, delete'</literal>.
>>            </para>
>> +          <para>
>> +            <command>TRUNCATE</command> is treated as a form of
>> +            <command>DELETE</command> for the purpose of deciding whether
>> +            to publish, or not.
>> +          </para>
>>           </listitem>
>>          </varlistentry>
>>         </variablelist>
>
> Why is this a good idea?

TRUNCATE removes rows, just as DELETE does, so anybody that wants to
publish the removal of rows will be interested in this.

This avoids unnecessary overcomplication of the existing interface.

>> +      * Write a WAL record to allow this set of actions to be logically decoded.
>> +      * We could optimize this away when !RelationIsLogicallyLogged(rel)
>> +      * but that doesn't save much space or time.
>
> What you're saying isn't that you're not logging anything, but that
> you're allocating the header regardless? Because this certainly sounds
> like you unconditionally log a WAL record.

It says that, yes, my idea - as explained.

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


pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: PATCH: Configurable file mode mask
Next
From: Arthur Zakirov
Date:
Subject: Re: json(b)_to_tsvector with numeric values