Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u0csf-004ekd-Sz for pgsql-general@arkaria.postgresql.org; Fri, 04 Apr 2025 08:58:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u0cse-00FhNh-FP for pgsql-general@arkaria.postgresql.org; Fri, 04 Apr 2025 08:58:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u0cse-00FhNY-3A for pgsql-general@lists.postgresql.org; Fri, 04 Apr 2025 08:58:28 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u0csc-002t8n-1G for pgsql-general@lists.postgresql.org; Fri, 04 Apr 2025 08:58:27 +0000 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-af548cb1f83so1633336a12.3 for ; Fri, 04 Apr 2025 01:58:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743757105; x=1744361905; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=6Ihw99BCjmsIQFgbGa35vFKw1p8mzjhThgEMnciQ9W0=; b=eWr1dyqs8OKs7HNgKuEc5BrA1oIXL9WP35Qb6ke/40Vye9jTdnSi1Ui4zSRJuGOQAQ yWccEp5K8CepFqC1YBuZdyg8GQuTj3o7rHUQpmG5C0e78dQg/KXLNuFyRz7EV4hLNam9 4E/LPdZaRvDPxdbhYUxoxvYB39UwKuu9COsL2/hId1ko/RQXP/XAejsHEAIyvuz1mz8C VgrvK7zsP4Pn5qwVpSVRPVAzEshHsj5g8wS4Tb6uolOPyWcgqSejYzaZthBzKj/2MhCa o1ZjFdd4u9F+bop7Z8ZbK7ho8FfEFGSrfJR7dJCikuCdQmFx8vsIHebSlfe+A12PYgva DLvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743757105; x=1744361905; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6Ihw99BCjmsIQFgbGa35vFKw1p8mzjhThgEMnciQ9W0=; b=VehdnAMgcfOD96qA1bjq7is3Vd4hhmPUkqaEt7Yz7jqlQenIVkGf1E5aTuol7Pb16B GddIXJlPMQUSKt7iBTpq9awuzNtenvn8BVXMQwEtSY833DuoKv2I7WB9A4JWyfg0DH/E h0NXc3hScgzMtgr+eHxhFyLVjJiodSmCR5sl7m1bnXs14sSdDVUt1bwln+UaJdx9c0uM npK9Fc7tr5Savm00fDK6JCYswNH02Y5kfdPRmtGITYpL10jxgD6fDnoApu657WcZLt1W gqwu/sOvT5kvdNWz+m+RYBOv1Pbqqmx6s/+1fDeQ3Sa6d6qxf+nj/8T1U4anFb0qd+aE HQXQ== X-Gm-Message-State: AOJu0Yzua47PNRIScfflLuAy2KR6JKHzCPkBc584ZvEjNoUYpVKhbgiN VHWC1izur0boXCHIfgTfbegzegl5pxa2E5isnAw3y5bzmAJEK1elL9+bV5JXQC+ekBN4+HtJDeA Tm8z0IWX507dtRSSamEQaacQLplefnrVQICs= X-Gm-Gg: ASbGncvc3oqbFGsjqoVvAnkywexH44IPCFQukqqlLSOaOuxTFjnn/sne3cvI0q61si9 AJPSV91Oc0a3nXYNHUJgBH5D05nNhabh8cvOe92jfzsfqL0lBMswQGY7de5k13eptdfuTh3NINo xZeibXlUZ+T2mI5q/io/Wunbplhzs= X-Google-Smtp-Source: AGHT+IE4aX3LSGRV/XXQ8drc8xumak9bj5HaxRI8wBrIPQpZvYa4baDe5ppiuobiGv7knXhWerrH70ULQ+T7uL1q8h4= X-Received: by 2002:a17:90b:6ce:b0:2ee:df70:1ff3 with SMTP id 98e67ed59e1d1-306a46f6254mr4966727a91.0.1743757104809; Fri, 04 Apr 2025 01:58:24 -0700 (PDT) MIME-Version: 1.0 From: Willy-Bas Loos Date: Fri, 4 Apr 2025 10:58:13 +0200 X-Gm-Features: AQ5f1JrFRvjkD-UQr_5ilBQpM9sLDLyi3sm49S5O9b1ID-PkBEG24rnihq7TACs Message-ID: Subject: find replication slots that "belong" to a publication To: pgsql-general Content-Type: multipart/alternative; boundary="000000000000ce94da0631f0161e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ce94da0631f0161e Content-Type: text/plain; charset="UTF-8" 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 --000000000000ce94da0631f0161e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

I'm looking for a wa= y 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 sur= e.

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 a= re restricted to the publisher node.

Th= e best I could find was a query listed in pg_stat_activity that lists the s= lot name and the publication name:
START_REPLICATION SLOT "m= y_slot" LOGICAL 5DD1/3E56D360 (proto_version '1', publication_= names '"my_publication"')

=
I don't like the idea of using string manipulation on such query s= trings to get the information I need. Postgres must have a way to compose t= his query.
Can anyone tell me a way to find replication slots tha= t belong to a publication?

= --
Willy-Bas Loos
--000000000000ce94da0631f0161e--