Re: Add 'worker_type' to pg_stat_subscription

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add 'worker_type' to pg_stat_subscription
Date: 2023-09-01 19:41:54
Message-ID: 20230901194154.GA3182997@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 16, 2023 at 07:14:18PM +1000, Peter Smith wrote:
> Earlier this year I proposed a small change for the pg_stat_subscription view:
>
> ------
> ...it would be very useful to have an additional "kind" attribute for
> this view. This will save the user from needing to do mental
> gymnastics every time just to recognise what kind of process they are
> looking at.
> ------
>
> At that time Amit replied [1] that this could be posted as a separate
> enhancement thread.
>
> Now that the LogicalRepWorkerType has been recently pushed [2]
> (something with changes in the same area of the code) it seemed the
> right time to resurrect my pg_stat_subscription proposal.

This sounds generally reasonable to me.

<row>
<entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>worker_type</structfield> <type>text</type>
+ </para>
+ <para>
+ Type of the subscription worker process. Possible values are:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>a</literal>: apply worker
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>p</literal>: parallel apply worker
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>t</literal>: tablesync worker
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para></entry>
+ </row>

Is there any reason not to spell out the names? I think that would match
the other system views better (e.g., backend_type in pg_stat_activity).
Also, instead of "tablesync worker", I'd suggest using "synchronization
worker" to match the name used elsewhere in this table.

I see that the table refers to "leader apply workers". Would those show up
as parallel apply workers in the view? Can we add another worker type for
those?

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2023-09-01 19:53:54 Re: Replace known_assigned_xids_lck by memory barrier
Previous Message Melanie Plageman 2023-09-01 19:34:33 Why doesn't Vacuum FULL update the VM