Re: Regarding huge logical slot lag between source and target

From: Durgamahesh Manne <maheshpostgres9(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Regarding huge logical slot lag between source and target
Date: 2026-10-18 17:46:03
Message-ID: CAJCZkoLpO_2eDYW-nB2Fv7HtM=_0ET+mQthk6mAG8Wb9p2JorA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 18 Oct, 2026, 23:11 Durgamahesh Manne, <maheshpostgres9(at)gmail(dot)com>
wrote:

>
>
> On Sun, 18 Oct, 2026, 22:52 Laurenz Albe, <laurenz(dot)albe(at)cybertec(dot)at>
> wrote:
>
>> On Sun, 2026-10-18 at 19:49 +0530, Durgamahesh Manne wrote:
>> > Logical slot lag 330GB on source grows faster during the huge
>> modifications but it should be minimized which is not happened when load
>> goes down.
>> >
>> > What is the action need to take for minimizing the lag to normal state.
>> > Source version 16
>> > Target version 16
>> > Sufficient resources allocated and tuned replication related parameters
>>
>> ALTER SUBSCRIPTION sub SET (streaming = parallel);
>>
>> Also, set the following parameters to generous values (as your hardware
>> allows):
>>
>> On the publisher:
>>
>> logical_decoding_work_mem
>>
>> On the subscriber:
>>
>> max_logical_replication_workers
>> max_worker_processes
>> max_parallel_apply_workers_per_subscription
>> max_sync_workers_per_subscription
>>
>> Note the dependencies: max_worker_processes must accommodate for all the
>> worker processes.
>>
>> Yours,
>> Laurenz Albe
>>
>
>
> Hi
> I already set those params with required values to make server running
> smoothly
>
> Alter subscription also done with binary and streaming options
>
> Finally I could not find root cause what has caused to increase of that
> much lag.
>
> No long running queries at source
> No blocking at target
> Generally what might be reason to huge lag in terms of hundreds which
> can't go down.
>
> This is very rare situation we face an issue like this
>
>
> As final decision I resync data from scratch.
> Regards
> Durga Mahesh
>

Hi what is the formula to set this logical_decoding_work_mem?

I set 4Gb
When we have huge DML ops what value can be recommended.

Ram 128gb

Regards
Durga Mahesh

>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2026-10-18 18:43:46 Re: Regarding huge logical slot lag between source and target
Previous Message Durgamahesh Manne 2026-10-18 17:41:59 Re: Regarding huge logical slot lag between source and target