Re: On a subscriber, why is last_msg_send_time in pg_stat_subscription sometimes null?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Koen De Groote <kdg(dot)dev(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: On a subscriber, why is last_msg_send_time in pg_stat_subscription sometimes null?
Date: 2024-08-23 15:02:56
Message-ID: 65d55d32-c9c3-4446-a367-d3cca3282dea@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/23/24 07:33, Koen De Groote wrote:
> I'm running this query:
>
> SELECT subname, received_lsn, latest_end_lsn,
> last_msg_send_time, last_msg_receipt_time
> FROM pg_catalog.pg_stat_subscription;
>
> And "last_msg_send_time" will sometimes be null. All I can find in the
> documentation is that this value represents: "Send time of last message
> received from origin WAL sender; NULL for parallel apply workers"
>
> But I have no context for what parallel apply workers are or why they
> are NULL sometimes and other times not. >
> Can anyone explain?

The source has that information:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/replication/logical/applyparallelworker.c;h=e7f7d4c5e4bd3ff63687cb21b84534a05a3962cc;hb=HEAD

The top part explains the process.

As to the time:

/*
* There are three fields in each message received by the parallel apply
* worker: start_lsn, end_lsn and send_time. Because we have updated these
* statistics in the leader apply worker, we can ignore these fields in the
* parallel apply worker (see function LogicalRepApplyLoop).
*/

>
> Regards,
> Koen De Groote

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Tice 2024-08-23 16:14:34 dead tuple difference between pgstattuple and pg_stat_user_tables
Previous Message Morris de Oryx 2024-08-23 14:36:21 Re: Is there a way to translate pg_amop.amopstrategy into a description?