Re: Logical replication prefetch

From: Konstantin Knizhnik <knizhnik(at)garret(dot)ru>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Logical replication prefetch
Date: 2025-07-13 12:36:30
Message-ID: d20632a8-13f0-413f-a272-a8f9657e0238@garret.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 13/07/2025 1:28 pm, Amit Kapila wrote:
> On Tue, Jul 8, 2025 at 12:06 PM Konstantin Knizhnik <knizhnik(at)garret(dot)ru> wrote:
>> There is well known Postgres problem that logical replication subscriber
>> can not caught-up with publisher just because LR changes are applied by
>> single worker and at publisher changes are made by
>> multiple concurrent backends.
>>
> BTW, do you know how users deal with this lag? For example, one can
> imagine creating multiple pub-sub pairs for different sets of tables
> so that the workload on the subscriber could also be shared by
> multiple apply workers. I can also think of splitting the workload
> among multiple pub-sub pairs by using row filters

Yes, I saw that users starts several subscriptions/publications to
receive and apply changes in parallel.
But it can not be considered as universal solution:
1. Not always there are multiple tables (or partitions of one one table)
so that it it possible to split them between multiple publications.
2. It violates transactional behavior (consistency): if transactions
update several tables included in different publications then applying
this changes independently, we can observe at replica behaviour when one
table is update - and another - not. The same is true for row filters.
3. Each walsender will have to scan WAL, so having N subscriptions we
have to read and decode WAL N times.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikita Malakhov 2025-07-13 12:45:41 Re: Some ExecSeqScan optimizations
Previous Message Konstantin Knizhnik 2025-07-13 12:29:35 Re: Logical replication prefetch