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 1gXzLk-0005ac-9w for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Dec 2018 02:06:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gXzLi-0005o1-Ry for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Dec 2018 02:06:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXzLi-0005nn-Ha for pgsql-hackers@lists.postgresql.org; Sat, 15 Dec 2018 02:06:38 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXzLf-0003IK-QK for pgsql-hackers@lists.postgresql.org; Sat, 15 Dec 2018 02:06:37 +0000 Received: by mail-qt1-x82e.google.com with SMTP id v11so8415739qtc.2 for ; Fri, 14 Dec 2018 18:06:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=naa3+lsrQ/fQ0wPAlR1PhRKioktStLvQwBvvMJxZjyg=; b=wzHE2UtAk+z586Ip+ylmhW6e1TBAlCXi4XFOTeMVyjf2qMw0r8AsYtkpZZGPwOE52n qPdepq+SqfPM9w63cTO/y/mLoeRA8s+7GGOl9k/aF88iqNw1i5F8D8bIq8Fhja7+FqLD cTH/41Ey8xbdCu/6lV4dfKDuoj8BLMdFCtP3wUX4iUg5d5sLMde17v2Ot9C6X4fpLfXx O48BHz9C69OVBsANoZSCs9J7mwwEKvuz1ijL0QAB4b2pAoVNDR7b28FDXJmO7mdJHIHT fjsrHbweSo6VZEmAfhbmMyO/oIlITrWzYtESrni6haluZ+NAYSDzz2kRQl9aQ6LHWPZK qKbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=naa3+lsrQ/fQ0wPAlR1PhRKioktStLvQwBvvMJxZjyg=; b=sls4RmmQAmmN2B77aObLJ3dPBrg5SOU9frnixNZ5o5pIbNXEV3qMdV61OoBGr2i0ck Lb3p6lC7vqac5RZpdeTltBii5WgfmHxOD0OHvfsJcSO+l/yZUFnWI07xciahmlAWfACA GbfEBusgZsI0b+bRPGDN+b+TJW8glRGP3wFXIr/N4Fvln+lRLlA2+MYMrGGcapWQbWfH KLXKHjXhnen3sBXU7/rCQ6kG2YxAuTRgJEO5HRQOUwfj60Of/tEwMCeVe2HZj+5xYn9z 3nF3ss8Wl6GwfIP0P4O+iN/sdknjfjgOvrDLIt0XhtZfWjRUjFEt5w0c7j+8JWzucBoY TCyQ== X-Gm-Message-State: AA+aEWYyzSFK/3gAfQuCXmjsmEM7htkFqjjlUOEQJLWbqClfDuqgCs4M 87Kbg+cAqF3h6oggmN3n3NQJQQ== X-Google-Smtp-Source: AFSGD/XErYqdaJZk7E6EMvTU47xQ5aW665qDVczxWDjs/naOGBGDqL8XUCcD62aiKB5p/K8S8TzimQ== X-Received: by 2002:a0c:9257:: with SMTP id 23mr5099317qvz.142.1544839594720; Fri, 14 Dec 2018 18:06:34 -0800 (PST) Received: from alvin.alvh.no-ip.org ([201.186.80.67]) by smtp.gmail.com with ESMTPSA id z8sm2990500qto.45.2018.12.14.18.06.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 18:06:34 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id C16A5A01; Fri, 14 Dec 2018 23:06:32 -0300 (-03) Date: Fri, 14 Dec 2018 23:06:32 -0300 From: Alvaro Herrera To: Robert Haas Cc: Tom Lane , PostgreSQL Hackers Subject: Re: removal of dangling temp tables Message-ID: <20181215020632.5vlffyvfpn4k42cn@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-Dec-14, Robert Haas wrote: > On Fri, Dec 14, 2018 at 6:35 PM Tom Lane wrote: > > Hm. It *could*, if we wanted it to run some transactions after > > finishing recovery. > > It'd have to launch a separate process per database. That would be > useful infrastructure for other things, too, like automatic catalog > upgrades in minor releases, but I'm not volunteering to write that > infrastructure right now. This looks like a major project. > > 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? > > Yes, that seems like a possibly promising approach. I did propose in my OP the idea of a PGPROC boolean flag that indicates whether the temp namespace has been set up. If not, have autovac remove those tables. I like this option better, but I fear it adds more ProcArrayLock contention. Maybe I can just use a new LWLock to coordinate that particular member of the ProcGlobal array ... (but then it can no longer be a boolean.) -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services