public inbox for [email protected]  
help / color / mirror / Atom feed
find replication slots that "belong" to a publication
2+ messages / 1 participants
[nested] [flat]

* find replication slots that "belong" to a publication
@ 2025-04-04 08:58  Willy-Bas Loos <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Willy-Bas Loos @ 2025-04-04 08:58 UTC (permalink / raw)
  To: pgsql-general <[email protected]>

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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: find replication slots that "belong" to a publication
@ 2025-04-04 11:42  Willy-Bas Loos <[email protected]>
  parent: Willy-Bas Loos <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Willy-Bas Loos @ 2025-04-04 11:42 UTC (permalink / raw)
  To: pgsql-general <[email protected]>

postgres 13 BTW

On Fri, Apr 4, 2025 at 10:58 AM Willy-Bas Loos <[email protected]> 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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-04-04 11:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-04-04 08:58 find replication slots that "belong" to a publication Willy-Bas Loos <[email protected]>
2025-04-04 11:42 ` Willy-Bas Loos <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox