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.96) (envelope-from ) id 1wfomq-005hcY-0h for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jul 2026 01:03:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wfomo-009aUW-23 for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jul 2026 01:03:14 +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.96) (envelope-from ) id 1wfomo-009aUO-0X for pgsql-hackers@lists.postgresql.org; Sat, 04 Jul 2026 01:03:14 +0000 Received: from rusty.tulip.relay.mailchannels.net ([23.83.218.252]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wfomk-00000001Z0o-1uE3 for pgsql-hackers@lists.postgresql.org; Sat, 04 Jul 2026 01:03:13 +0000 X-Sender-Id: dreamhost|x-authsender|nico@cryptonector.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 236A04617D0; Sat, 04 Jul 2026 01:00:52 +0000 (UTC) Received: from pdx1-sub0-mail-a228.dreamhost.com (trex-green-1.trex.outbound.svc.cluster.local [100.99.149.21]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id B2716460A21; Sat, 04 Jul 2026 01:00:51 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|nico@cryptonector.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|nico@cryptonector.com X-MailChannels-Auth-Id: dreamhost X-Troubled-Spicy: 785c3c05586fff4f_1783126851945_441688158 X-MC-Loop-Signature: 1783126851945:1240699994 X-MC-Ingress-Time: 1783126851945 Received: from pdx1-sub0-mail-a228.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.99.149.21 (trex/8.0.2); Sat, 04 Jul 2026 01:00:51 +0000 Received: from ubby (unknown [24.28.102.31]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by pdx1-sub0-mail-a228.dreamhost.com (Postfix) with ESMTPSA id 4gsXNz1czYzMp; Fri, 3 Jul 2026 18:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cryptonector.com; s=dreamhost; t=1783126851; bh=+gwnB6mzftBAId+HrWSQ9Z3e1sjA2iakDf32VBVtUt8=; h=Date:From:To:Cc:Subject:Content-Type; b=hcTY7vJu+GSbSf53VwjIuHPEoGecOJYzkdJvCXpEfvL2iaviQDG5YoELcXA7pWky5 06vUZH6DzTOk7hUkm0AM3BzpnaTDL68O/0axpqYJdweqCvCG4kjOVEjyRYSDPqapyO a3t60H8N/GS+FZqbGusMncBQJuT87xncyPoX6ojdTsGfR4TFqB6XCkOdc5r1hs6NSD dJw1KFw1dwfB3r786CiKgrnrLguh8dYwBAulvJMR1i2T6HsxyOCj1FSf64+yxAwnfN 2xmrQWMKBF/ei3n0RQgkkV/Fr+QZnKkM50n8lVtUIegffWpHBkI8aF4ClAcKJ22DBN lsgaFgis1PpPw== Date: Fri, 3 Jul 2026 20:00:49 -0500 From: Nico Williams To: Dean Rasheed Cc: PostgreSQL Hackers Subject: Re: Global temporary tables Message-ID: References: <251A02BE-A148-4FEF-90EB-5E9559310B8E@dunslane.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Jul 04, 2026 at 12:32:42AM +0100, Dean Rasheed wrote: > On Thu, 2 Jul 2026 at 00:20, Nico Williams wrote: > > > > I drove Claude through a review. You can too, so there's nothing > > special to it, but I'll go over it here, with a bit of my content added, > > and hopefully y'all don't hate me for sharing LLM outputs. > > Wow, we really will be out of a job in a few years :-) I seriously doubt it. And I'm guessing you coded w/o assistance, so hats off because it looks pretty good. I only used an LLM for the review because I'm not sufficiently familiar with PG internals to do a solid review myself, and I want to help this along. > > And, ah, well, I guess you could say that `relfrozenxid` in > > `pg_class` is not meaningful for GTTs, or that you'll get your > > session's GTT's relfrozenxid. > > Yes, that's a very accurate description of the design choice I made. > Having thought more about it, I think the other choice is better, > because it's simpler, and it reduces churn on pg_class. Good. I think seeing some other session's frozenxid would be weird, and a bit of a leak. > So v6 now sets pg_class.relfrozenxid and pg_class.relminmxid to 0 for > all global temporary relations, and only the pg_temp_class values are > ever updated. That seems more logical, because a GTT has no storage > until it is used by some session, so it makes sense for the frozen > XIDs in pg_class to be 0. Yes. > I'll try and post another update soon, addressing other people's > review comments. I'll drive an LLM through this too sometime, especially with an eye to testing. I'm super excited to have GTTs in PG. It's going to make all sorts of things much easier for me and many many others, so thank you so much! Nico --