Re: Design of pg_stat_subscription_workers vs pgstats

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Design of pg_stat_subscription_workers vs pgstats
Date: 2022-02-19 16:16:40
Message-ID: CAKFQuwa_VKFk0g4tZMG5zQuJttNX1YkBWZrAAECs1hDiumjKsQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Feb 19, 2022 at 9:02 AM Andres Freund <andres(at)anarazel(dot)de> wrote:

>
> Even leaving everything else aside, a key of (dboid, subid, subrelid),
> where
> subrelid can be NULL, but where (dboid, subid) is *not* unique, imo is poor
> relational design. What is the justification for mixing relation specific
> and
> non-relation specific contents in this view?
>

The to-be-created pg_subscription_worker_error has this same design.
It really is a worker-oriented view so the PK should ideally (ignoring
dboid at the moment) be just workerid and subid and subrelid would just be
attributes, of which subrelid is optional. But a worker's natural key is
(subid, subrelid) so long as you accept that null has to be considered
equal to itself. Not usually an ideal model to pick but it seems like this
is one of those exceptions to the rule that works just fine. Feel free to
use InvalidOID instead of null if that makes things more consistent and
easier to implement. The conceptual model is still the same. It doesn't
seem to be beneficial to have tablesync and apply workers have their own
distinct relations. They are similar enough that they can share this one.

> IOW, we should just drop pg_stat_subscription_workers, and add a few
> counters
> to pg_stat_subscription.
>
>
+1
David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-02-19 16:22:29 Re: Time to drop plpython2?
Previous Message Melanie Plageman 2022-02-19 16:06:18 Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)