Re: row filtering for logical replication

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: onderkalaci(at)gmail(dot)com, david(at)pgmasters(dot)net, "Craig Ringer" <craig(at)2ndquadrant(dot)com>, "Tomas Vondra" <tomas(dot)vondra(at)2ndquadrant(dot)com>, "Michael Paquier" <michael(at)paquier(dot)xyz>, "Amit Langote" <amitlangote09(at)gmail(dot)com>, "movead li" <movead(dot)li(at)highgo(dot)ca>
Subject: Re: row filtering for logical replication
Date: 2021-02-01 00:23:04
Message-ID: 4dbad191-9b40-4bb6-8940-d18f2e93c3ce@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 16, 2020, at 10:58 AM, David Steele wrote:
> Please submit to a future CF when a new patch is available.
Hi,

This is another version of the row filter patch. Patch summary:

0001: refactor to remove dead code
0002: grammar refactor for row filter
0003: core code, documentation, and tests
0004: psql code
0005: pg_dump support
0006: debug messages (only for test purposes)
0007: measure row filter overhead (only for test purposes)

From the previous version I incorporated Amit's suggestions [1], improve documentation and tests. I refactored to code to make it simple to read (break the row filter code into functions). This new version covers the new parameter publish_via_partition_root that was introduced (cf 83fd4532a7).

Regarding function prohibition, I wouldn't like to open a can of worms (see previous discussions in this thread). Simple expressions covers most of the use cases that I worked with until now. This prohibition can be removed in another patch after some careful analysis.

I did some limited tests and didn't observe some excessive CPU usage while testing this patch tough I agree with Andres that retain some expression context into a cache would certainly speed up this piece of code. I measured the row filter overhead in my i7 (see 0007) and got:

mean: 92.49 us
stddev: 32.63 us
median: 83.45 us
min-max: [11.13 .. 2731.55] us
percentile(95): 117.76 us

[1] https://www.postgresql.org/message-id/CA%2BHiwqG3Jz-cRS%3D4gqXmZDjDAi%3D%3D19GvrFCCqAawwHcOCEn4fQ%40mail.gmail.com

--
Euler Taveira
EnterpriseDB: https://www.enterprisedb.com/

Attachment Content-Type Size
0001-Remove-unused-column-from-initial-table-synchronizat.patch text/x-patch 1.7 KB
0002-Rename-a-WHERE-node.patch text/x-patch 1.7 KB
0003-Row-filter-for-logical-replication.patch text/x-patch 61.5 KB
0004-Print-publication-WHERE-condition-in-psql.patch text/x-patch 1.2 KB
0005-Publication-WHERE-condition-support-for-pg_dump.patch text/x-patch 2.8 KB
0006-Debug-messages.patch text/x-patch 2.6 KB
0007-Measure-row-filter-overhead.patch text/x-patch 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-02-01 00:44:12 Re: Printing backtrace of postgres processes
Previous Message Mark Dilger 2021-02-01 00:05:15 Re: new heapcheck contrib module