Re: Binary support for pgoutput plugin - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Binary support for pgoutput plugin
Date
Msg-id 641297.1595271779@sss.pgh.pa.us
Whole thread Raw
In response to Re: Binary support for pgoutput plugin  (Petr Jelinek <petr@2ndquadrant.com>)
List pgsql-hackers
Petr Jelinek <petr@2ndquadrant.com> writes:
> On 20/07/2020 17:51, Tom Lane wrote:
>> I'm fixing that, but even after that, there's a semantic problem:
>> LOGICALREP_COLUMN_UNCHANGED is just a weak optimization, cf the code
>> that sends it, in proto.c around line 480.  colstatus will often *not*
>> be that for columns that were in fact not updated on the remote side.
>> I wonder whether we need to take steps to improve that.

> LOGICALREP_COLUMN_UNCHANGED is not trying to optimize anything, there is 
> certainly no effort made to not send columns that were not updated by 
> logical replication itself. It's just something we invented in order to 
> handle the fact that values for TOASTed columns that were not updated 
> are simply not visible to logical decoding (unless table has REPLICA 
> IDENTITY FULL) as they are not written to WAL nor accessible via 
> historic snapshot. So the output plugin simply does not see the real value.

Hm.  So the comment I added a couple days ago is wrong; can you propose
a better one?

However, be that as it may, we do have a provision in the protocol that
can handle marking columns unchanged.  I'm thinking if we tried a bit
harder to identify unchanged columns on the sending side, we could both
fix this semantic deficiency for triggers and improve efficiency by
reducing transmission of unneeded data.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Petr Jelinek
Date:
Subject: Re: Binary support for pgoutput plugin
Next
From: Alvaro Herrera
Date:
Subject: Re: Allow ERROR from heap_prepare_freeze_tuple to be downgraded to WARNING