Re: find replication slots that "belong" to a publication

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Justin <zzzzz(dot)graf(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: find replication slots that "belong" to a publication
Date: 2025-04-07 20:32:55
Message-ID: CAHnozTi5e4pXo2myty8OOtLOatLwNADh1p8ThNhm3LenUQjzsw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Laurenz,

Thanks for answering!
I find it very strange, because the publication is needed to make a
subscription, which makes the slot.
Thanks for looking into it and helping me understand.

Cheers!
Willy-Bas Loos

On Mon, Apr 7, 2025 at 3:31 PM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
wrote:

> On Mon, 2025-04-07 at 12:16 +0200, Willy-Bas Loos wrote:
> > My question is not so much about "can i drop a certain replication
> slot",
> > more about "does this publication still have any replication slots?".
> > Or, if you will: "what's the publication for this replication slot?".
> >
> > I've double checked the views that you suggested, and I found that I can
> relate
> > the WAL sender processes to replication slots through
> pg_replication_slots.active_pid .
> > I've also looked into replication origins.
> >
> > But I can't find a link to the publication. And that's what I need to
> know.
>
> I don't think that there is a connection between a publication and a
> replication slot. That connection is only made when a subscriber connects
> and runs the START_REPLICATION command [1] and specifies the "pgoutput"
> plugin with the "publication_names" option [2].
>
> I don't think you can see that information reflected in a system view
> on the primary. You'd have to query "pg_subscription" on the standby.
>
> Yours,
> Laurenz Albe
>
>
> [1]:
> https://www.postgresql.org/docs/current/protocol-replication.html#PROTOCOL-REPLICATION-START-REPLICATION-SLOT-LOGICAL
> [2]:
> https://www.postgresql.org/docs/current/protocol-logical-replication.html#PROTOCOL-LOGICAL-REPLICATION-PARAMS
>

--
Willy-Bas Loos

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2025-04-07 20:44:08 Re: find replication slots that "belong" to a publication
Previous Message Adrian Klaver 2025-04-07 19:36:32 Re: Slow timestamp query after upgrading from Pg13 to Pg16