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

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: find replication slots that "belong" to a publication
Date: 2025-04-04 11:42:50
Message-ID: CAHnozTgTfoSqAR_4e4-gWkrMsK-ETKS3tgDnM_d7FvyckZeGXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

postgres 13 BTW

On Fri, Apr 4, 2025 at 10:58 AM Willy-Bas Loos <willybas(at)gmail(dot)com> wrote:

> Hi!
>
> I'm looking for a way to find out if there are still replication slots
> active for a publication before dropping the publication in an automated
> way. The idea is that the publication is thought not to be needed any
> longer, but we want to make sure.
>
> I'm having trouble finding a link between a publication, the subscriptions
> and the replication slots. Especially when you don't want to make
> assumptions about any subscriber nodes, so you are restricted to the
> publisher node.
>
> The best I could find was a query listed in pg_stat_activity that lists
> the slot name and the publication name:
> START_REPLICATION SLOT "my_slot" LOGICAL 5DD1/3E56D360 (proto_version '1',
> publication_names '"my_publication"')
>
> I don't like the idea of using string manipulation on such query strings
> to get the information I need. Postgres must have a way to compose this
> query.
> Can anyone tell me a way to find replication slots that belong to a
> publication?
>
> --
> Willy-Bas Loos
>

--
Willy-Bas Loos

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dimitrios Apostolou 2025-04-04 13:13:09 Re: Performance issues during pg_restore -j with big partitioned table
Previous Message Stijn Sanders 2025-04-04 11:41:17 Re: Will PQsetSingleRowMode get me results faster?