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 1u1tKL-009vst-5k for pgsql-general@arkaria.postgresql.org; Mon, 07 Apr 2025 20:44:17 +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 1u1tKJ-003ojj-Kh for pgsql-general@arkaria.postgresql.org; Mon, 07 Apr 2025 20:44:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u1tKI-003oja-Ou for pgsql-general@lists.postgresql.org; Mon, 07 Apr 2025 20:44:15 +0000 Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u1tKF-003zQF-1Z for pgsql-general@lists.postgresql.org; Mon, 07 Apr 2025 20:44:14 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id A0C5C114019E; Mon, 7 Apr 2025 16:44:09 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Mon, 07 Apr 2025 16:44:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1744058649; x=1744145049; bh=UQMDlcxCjV/1wJz/PxQ+F0y3j4ps+jG5xiVjoR3omdE=; b= DWKw+cR8Ymy5XUrpe8xArTO83Tfa3TMEcEa6IFVW2QM4MpqZyFqSVSSA4achhKhg tavNxTrTdwSyAwpDsx3cPGLkn+FDjog0duA5WUDtEBoaADIF8qfe5vCwNRO5SY8z tX++ru513Scqp3GRmzOk3KCAVgd63DgM1I/Rp+uT6cLs4KEaZmqUQGHKfPl3umqH F7DhQ//srqBjstzf2TPtv3jVFFgDFmnbIVYzAPxr3swXy6/2dnU2r46QscpQ7ro+ KFXyBISfndv2OASMavPXpcUwwjUIw+EUBnFjGwXnAGafDT+N7ZbmHqNS7fSansTJ R9HMZS2FKnDxFNmmPqJUMw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1744058649; x= 1744145049; bh=UQMDlcxCjV/1wJz/PxQ+F0y3j4ps+jG5xiVjoR3omdE=; b=u 1Hrfh2Dl5AdhU8r0vzpwirCwkjPwTItjZSVyXxZGjDDr/Q0/JozzDA/Z7G1fQcX5 vIaeZOIxQai+xecFpls27tZoqEMzC5qFzTgigOFaIsMca62uOi2G2qvpb2+Zdv2i oEUUOyZ7BqpDjijdpRejfByvYvzWFfZfVojn0oOWUzc9K+0jU5HGDxIxxQiGLMyz 3mJjW6yabpnttUCMLgIziqn4r1WtDDHHGViAZPVimJkmUbYSlaw53IjYdPC+YSrs 70Wph7hsWsHJMfxg7gj+J6/+gsUdJMedBX7bAp9h8nhVRLX0j6kjEe51o0LCnbiJ HUBWJswhk5ezIY/G0UDmA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvtdduudekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddt vdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepgfdufeekhfevfeel veeiueevhedvuddukeduvddvlefhueeuieejtdeuvdevvdeunecuffhomhgrihhnpehpoh hsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpd hnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeifihhl lhihsggrshesghhmrghilhdrtghomhdprhgtphhtthhopehlrghurhgvnhiirdgrlhgsvg estgihsggvrhhtvggtrdgrthdprhgtphhtthhopeiiiiiiiiiirdhgrhgrfhesghhmrghi lhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpoh hsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Apr 2025 16:44:08 -0400 (EDT) Message-ID: Date: Mon, 7 Apr 2025 13:44:08 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: find replication slots that "belong" to a publication To: Willy-Bas Loos , Laurenz Albe Cc: Justin , pgsql-general References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/7/25 13:32, Willy-Bas Loos wrote: > Hi Laurenz, > > Thanks for answering! > I find it very strange, because the publication is needed to make a > subscription, which makes the slot. From here: https://www.postgresql.org/docs/current/logical-replication-subscription.html "A subscription defines the connection to another database and set of publications (one or more) to which it wants to subscribe." and here: "PUBLICATION publication_name [, ...] Names of the publications on the publisher to subscribe to. " Finding the subscriptions for a given publication and deleting those slots may break the subscription on the receiving side if it is looking for data from more then one publication. > Thanks for looking into it and helping me understand. > > Cheers! > Willy-Bas Loos > > > On Mon, Apr 7, 2025 at 3:31 PM Laurenz Albe > 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 -- Adrian Klaver adrian.klaver@aklaver.com