Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 0D38F63291F for ; Sat, 24 Apr 2010 14:31:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60762-10 for ; Sat, 24 Apr 2010 17:31:25 +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 5370A63265B for ; Sat, 24 Apr 2010 14:31:25 -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 o3OHVNUO009320; Sat, 24 Apr 2010 13:31:23 -0400 (EDT) To: Robert Haas cc: Greg Sabino Mullane , pgsql-hackers@postgresql.org Subject: Re: global temporary tables In-reply-to: References: <7796.1272125493@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Sat, 24 Apr 2010 13:16:20 -0400" Date: Sat, 24 Apr 2010 13:31:23 -0400 Message-ID: <9319.1272130283@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201004/1120 X-Sequence-Number: 161232 Robert Haas writes: > At least AIUI, the use case for this feature is that you want to avoid > creating "the same" temporary table over and over again. The context that I've seen it come up in is that people don't want to clutter their functions with create-it-if-it-doesn't-exist logic, which you have to have given the current behavior of temp tables. Any performance gain from reduced catalog churn would be gravy. Aside from the DROP problem, I think this implementation proposal has one other big shortcoming: what are you going to do about table statistics? In many cases, you really *have* to do an ANALYZE once you've populated a temp table, if you want to get decent plans for it. Where will you put those stats? regards, tom lane