Re: row filtering for logical replication - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: row filtering for logical replication
Date
Msg-id 7ee3ec83-3e60-ba69-3ee9-a190a4b7714e@enterprisedb.com
Whole thread Raw
In response to Re: row filtering for logical replication  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: row filtering for logical replication  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers

On 7/14/21 4:01 PM, Alvaro Herrera wrote:
> On 2021-Jul-14, Dilip Kumar wrote:
> 
>> I think for insert we are only allowing those rows to replicate which
>> are matching filter conditions, so if we updating any row then also we
>> should maintain that sanity right? That means at least on the NEW rows
>> we should apply the filter, IMHO.  Said that, now if there is any row
>> inserted which were satisfying the filter and replicated, if we update
>> it with the new value which is not satisfying the filter then it will
>> not be replicated,  I think that makes sense because if an insert is
>> not sending any row to a replica which is not satisfying the filter
>> then why update has to do that, right?
> 
> Right, that's a good aspect to think about.
> 

I agree, that seems like a reasonable approach.

The way I'm thinking about this is that for INSERT and DELETE it's clear 
which row version should be used (because there's just one). And for 
UPDATE we could see that as DELETE + INSERT, and apply the same rule to 
each action.

On the other hand, I can imagine cases where it'd be useful to send the 
UPDATE when the old row matches the condition and new row does not.

> I think the guiding principle for which tuple to use for the filter is
> what is most useful to the potential user of the feature, rather than
> what is the easiest to implement.
> 

+1

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: gkokolatos@pm.me
Date:
Subject: Re: Introduce pg_receivewal gzip compression tests
Next
From: Tomas Vondra
Date:
Subject: Re: row filtering for logical replication