Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXsJe-0002Zc-8V for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Dec 2018 18:36:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gXsJc-0004ft-7x for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Dec 2018 18:36:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXsJc-0004fm-0r for pgsql-hackers@lists.postgresql.org; Fri, 14 Dec 2018 18:36:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXsJV-0002tT-Qc for pgsql-hackers@lists.postgresql.org; Fri, 14 Dec 2018 18:35:59 +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 wBEIZo9F009970; Fri, 14 Dec 2018 13:35:50 -0500 From: Tom Lane To: Robert Haas cc: Alvaro Herrera , PostgreSQL Hackers Subject: Re: removal of dangling temp tables In-reply-to: References: <20181214162843.37g6h3txto43akrb@alvherre.pgsql> <8545.1544810243@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Fri, 14 Dec 2018 13:16:30 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9968.1544812550.1@sss.pgh.pa.us> Date: Fri, 14 Dec 2018 13:35:50 -0500 Message-ID: <9969.1544812550@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Fri, Dec 14, 2018 at 12:57 PM Tom Lane wrote: >> I seem to recall discussions about having crash recovery go around >> and clean out temp tables. That seems like a better plan than >> penalizing every session start with this. > Well, crash recovery already removes the files, but it can't really > remove the catalog entries, can it? Hm. It *could*, if we wanted it to run some transactions after finishing recovery. But I guess I wonder why bother; if the disk space is gone then there's not that much reason to be in a hurry to get rid of the catalog entries. The particular problem Alvaro is complaining of might be better handled by ignoring temp tables while computing max freeze age etc. I have some recollection that we'd intentionally included them, but I wonder why really; it's not like autovacuum is going to be able to do anything about an ancient temp table. Alternatively, maybe we could have backends flag whether they've taken ownership of their temp schemas or not, and let autovacuum flush old temp tables if not? regards, tom lane