Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erQ73-0007j3-Ar for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Mar 2018 15:27:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erQ71-000060-Sm for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Mar 2018 15:27:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erQ71-00005q-LI for pgsql-hackers@lists.postgresql.org; Thu, 01 Mar 2018 15:27:15 +0000 Received: from lb2-smtp-cloud7.xs4all.net ([194.109.24.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erQ6z-0002zl-0F for pgsql-hackers@postgresql.org; Thu, 01 Mar 2018 15:27:15 +0000 Received: from webmailclassic.xs4all.nl ([IPv6:2001:888:0:22:194:109:20:212]) by smtp-cloud7.xs4all.net with ESMTPA id rQ6xersdj8U07rQ6xelzqw; Thu, 01 Mar 2018 16:27:12 +0100 Received: from gateway-1-39.erasmusmc.nl ([156.83.1.39]) by webmailclassic.xs4all.nl with HTTP (HTTP/1.1 POST); Thu, 01 Mar 2018 16:27:11 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 01 Mar 2018 16:27:11 +0100 From: Erik Rijkers To: Euler Taveira Cc: pgsql-hackers Subject: Re: row filtering for logical replication In-Reply-To: References: Message-ID: <34fa0f1d44222c4c8e2b9552e3fa423a@xs4all.nl> X-Sender: er@xs4all.nl User-Agent: XS4ALL Webmail X-CMAE-Envelope: MS4wfCz5HwYbbuJvuk8W9PIFWVKuc5fpDLH09MxXU6bDLb67Jnk0NSxeu97otlRYh6bxSUfVsCBKyN+DDyb4nwC/xUkpyewHMxgqcHe7V8bwtyTQtdw5dF8u c2s7QmGv6KLY999faklPQuqgEMAIdVbXjYBnZYvVztXvZlcrShRDZjxASfZ/pHeWNCHCZh1A8gJtwhsPgBW/bfPsQnaEdCPJtxBCKPCVx/zhZhy1sfrCtdiE 0YIcRbvJsaD9ZADoW5RPQOK5NoLeNKDVhcKArAXgc4s= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-03-01 00:03, Euler Taveira wrote: > The attached patches add support for filtering rows in the publisher. > 001-Refactor-function-create_estate_for_relation.patch > 0002-Rename-a-WHERE-node.patch > 0003-Row-filtering-for-logical-replication.patch > Comments? Very, very useful. I really do hope this patch survives the late-arrival-cull. I built this functionality into a test program I have been using and in simple cascading replication tests it works well. I did find what I think is a bug (a bug easy to avoid but also easy to run into): The test I used was to cascade 3 instances (all on one machine) from A->B->C I ran a pgbench session in instance A, and used: in A: alter publication pub0_6515 add table pgbench_accounts where (aid between 40000 and 60000-1); in B: alter publication pub1_6516 add table pgbench_accounts; The above worked well, but when I did the same but used the filter in both publications: in A: alter publication pub0_6515 add table pgbench_accounts where (aid between 40000 and 60000-1); in B: alter publication pub1_6516 add table pgbench_accounts where (aid between 40000 and 60000-1); then the replication only worked for (pgbench-)scale 1 (hence: very little data); with larger scales it became slow (taking many minutes where the above had taken less than 1 minute), and ended up using far too much memory (or blowing up/crashing altogether). Something not quite right there. Nevertheless, I am much in favour of acquiring this functionality as soon as possible. Thanks, Erik Rijkers