Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bTVXu-0007BC-7D for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Jul 2016 14:47:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bTVXt-0002GX-Lo for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Jul 2016 14:47:21 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bTVXr-0002Fs-3q for pgsql-hackers@postgresql.org; Sat, 30 Jul 2016 14:47:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bTVXo-0003lX-Dv for pgsql-hackers@postgresql.org; Sat, 30 Jul 2016 14:47:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u6UElAS0001185; Sat, 30 Jul 2016 10:47:10 -0400 From: Tom Lane To: Pavel Stehule cc: Tomas Vondra , PostgreSQL Hackers , Aleksander Alekseev Subject: Re: [Patch] Temporary tables that do not bloat pg_catalog (a.k.a fast temp tables) In-reply-to: References: <20160729141552.4062e19b@fujitsu> <39b0f423-a4df-3564-3b4a-b1de6f9eea80@2ndquadrant.com> Comments: In-reply-to Pavel Stehule message dated "Sat, 30 Jul 2016 06:49:05 +0200" Date: Sat, 30 Jul 2016 10:47:10 -0400 Message-ID: <1184.1469890030@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Pavel Stehule writes: > But there are some patterns used with work with temp tables,that should not > working, and we would to decide if we prepare workaround or not. > -- problematic pattern (old code) > IF NOT EXISTS(SELECT * FROM pg_class WHERE ....) THEN > CREATE TEMP TABLE xxx() > ELSE > TRUNCATE TABLE xxx; > END IF; > -- modern patter (new code) > BEGIN > TRUNCATE TABLE xxx; > EXCEPTION WHEN ..... THEN > CREATE TEMP TABLE(...) > END; If the former stops working, that's a sufficient reason to reject the patch: it hasn't been thought through carefully enough. The key reason why I don't think that's negotiable is that if there aren't (apparently) catalog entries corresponding to the temp tables, that will almost certainly break many things in the backend and third-party extensions, not only user code patterns like this one. We'd constantly be fielding bug reports that "feature X doesn't work with temp tables anymore". In short, I think that the way to make something like this work is to figure out how to have "virtual" catalog rows describing a temp table. Or maybe to partition the catalogs so that vacuuming away temp-table rows is easier/cheaper than today. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers