Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oc9Av-0008It-CL for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Sep 2022 17:42:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oc99v-0002OO-IC for pgsql-hackers@arkaria.postgresql.org; Sat, 24 Sep 2022 17:41:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oc99v-0002OF-8w for pgsql-hackers@lists.postgresql.org; Sat, 24 Sep 2022 17:41:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oc99s-0003lI-LH for pgsql-hackers@postgresql.org; Sat, 24 Sep 2022 17:41:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 28OHfcod2297421; Sat, 24 Sep 2022 13:41:38 -0400 From: Tom Lane To: Nathan Bossart cc: Greg Stark , pgsql-hackers@postgresql.org Subject: Re: identifying the backend that owns a temporary schema In-reply-to: <20220829230757.GA542616@nathanxps13> References: <20220815205811.GA250990@nathanxps13> <20220829230757.GA542616@nathanxps13> Comments: In-reply-to Nathan Bossart message dated "Mon, 29 Aug 2022 16:07:57 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2297419.1664041298.1@sss.pgh.pa.us> Date: Sat, 24 Sep 2022 13:41:38 -0400 Message-ID: <2297420.1664041298@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nathan Bossart writes: > On Tue, Aug 23, 2022 at 10:29:05AM +0100, Greg Stark wrote: >> Alternately should pg_stat_activity show the actual temp schema name >> instead of the id? I don't recall if it's visible outside the backend >> but if it is, could pg_stat_activity show whether the temp schema is >> actually attached or not? > I'm open to adding the backend ID or the temp schema name to > pg_stat_activity, but I wouldn't be surprised to learn that others aren't. FWIW, I'd vote against adding the temp schema per se. We can see from outside whether the corresponding temp schema exists, but we can't readily tell whether the session has decided to use it, so attributing it to the session is a bit dangerous. Maybe there is an argument for having sessions report it to pgstats when they do adopt a temp schema, but I think there'd be race conditions, rollback after error, and other issues to contend with there. The proposed patch seems like an independent first step in any case. One thing I don't like about it documentation-wise is that it leaves the concept of backend ID pretty much completely undefined. regards, tom lane