Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 3DAEA632D92 for ; Sat, 24 Apr 2010 22:37:46 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 92815-03 for ; Sun, 25 Apr 2010 01:37:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 5F7EF632BCE for ; Sat, 24 Apr 2010 22:37:35 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o3P1bWMR018127; Sat, 24 Apr 2010 21:37:32 -0400 (EDT) To: Robert Haas cc: Jim Nasby , Greg Sabino Mullane , pgsql-hackers@postgresql.org Subject: Re: global temporary tables In-reply-to: References: <7796.1272125493@sss.pgh.pa.us> <9319.1272130283@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Sat, 24 Apr 2010 21:14:44 -0400" Date: Sat, 24 Apr 2010 21:37:31 -0400 Message-ID: <18126.1272159451@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.105 tagged_above=-10 required=5 tests=AWL=-0.195, BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201004/1141 X-Sequence-Number: 161253 Robert Haas writes: > Unfortunately, I don't see much alternative to making smgr know > something about the temp-ness of the relation, though I'm hoping to > keep the smgr surgery to an absolute minimum. Maybe what we could do > is incorporate the backend ID or PID into the file name when the > relation is temp. Then we could scan for and nuke such files pretty > easily. Otherwise I can't really think how to make it work. I think that could be a really good idea, mainly because it makes post-crash cleanup MUCH safer: you can tell with certainty from the filename that it's a leftover temp table. The notion of zapping files just because we don't see them listed in pg_class has always scared the heck out of me. We already know temp-ness at pretty low levels, like bufmgr vs localbuf. Pushing it all the way down to smgr doesn't seem like a leap; in fact I think it would eliminate a separate isTemp parameter in a lot of places. regards, tom lane