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 1gXzHg-0005NR-OP for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Dec 2018 02:02:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gXzHf-0000Iq-Ex for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Dec 2018 02:02:27 +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 1gXzHf-0000Id-7M for pgsql-hackers@lists.postgresql.org; Sat, 15 Dec 2018 02:02:27 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXzHc-0001VK-FI for pgsql-hackers@lists.postgresql.org; Sat, 15 Dec 2018 02:02:26 +0000 Received: by mail-qk1-x743.google.com with SMTP id q70so4376546qkh.6 for ; Fri, 14 Dec 2018 18:02:23 -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=vLmBFS9q3B20yOi9V3ARxAzYQ/3QKUHy85QYtfZxEwE=; b=DmcRVQu2Yg3zUblD6tqS41dhkUwFpG5XfNAFzBnGtaF6gYRHzXO75ir+R0AYOP24BT Tp+4v6OimpzrfA8iMclk+dUymf979R388+gVCXhhZc615lps3qNZ8fzDTMnoaEq+zYJo TtYDt3hOwrNZgnzItgGAbQKgpcV2h8tMX/0NOgSf/fCXFxyvjzRJybVXchAB9Mo36d+7 MeNjiSfD99PKWjbGivMOt+2IBWhUhcI4IteOUoWc811Nef3834Yftb1fkyGavjiOx8+e Uz45KtW5APzQ3fALcgWSOTVG9CVCTF7aPn+cYpliWSEDyMDv5cW/OvlEmwvYXhfaKX88 g1/w== 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=vLmBFS9q3B20yOi9V3ARxAzYQ/3QKUHy85QYtfZxEwE=; b=fW5zSUEUOsPqvuxlvQ3FTgWS8OnbOWB1MMSwYE00QEYVOf0ue8IIrNTPdnzr7bZsNf mWuQyoHHyummH3EbAZ/MvoksfySOctNnTWOFMh/A3gQ1cmz75rqOew/9BYGtDgx7CIvQ rQipzfLLS8xTzP+/LCkGt6yij3f3tz3TD6vCj8ki+Hr1W3siu4dVuVLfyhb2ujQRc4mD kYiWc3C6iZLgs9zj8NI8ZOvOP1HhBxDWIaHP2DoWlobKZcPDRYhr299/wYkRGyctq8Hr ehvUrAma2F5itOOxXr9tLOuFPiCbtRdOLD1ETKhefhv9ifROpTgH4Nl0TGkcDT06Gief Gcmg== X-Gm-Message-State: AA+aEWageE/0NveZrrnEcNw0iI06yNVPUiHu6G+NxQTHop7XHtHX/d3J WpnExNPDA09KqGdThXj6KnSdhg== X-Google-Smtp-Source: AFSGD/XZ21Z4R/4QYcn9KbjFlpFiuksiXDvJWm2y1Izwdx42NyGkQ51j/weM/mbfg5vElaAnonX4jA== X-Received: by 2002:a37:8882:: with SMTP id k124mr4763401qkd.1.1544839342243; Fri, 14 Dec 2018 18:02:22 -0800 (PST) Received: from alvin.alvh.no-ip.org ([201.186.80.67]) by smtp.gmail.com with ESMTPSA id u45sm3179709qtk.33.2018.12.14.18.02.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Dec 2018 18:02:21 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 25797A01; Fri, 14 Dec 2018 23:02:20 -0300 (-03) Date: Fri, 14 Dec 2018 23:02:20 -0300 From: Alvaro Herrera To: Robert Haas Cc: PostgreSQL Hackers Subject: Re: removal of dangling temp tables Message-ID: <20181215020220.xk7j2trqbqtqmtdc@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 12:27 PM Alvaro Herrera > wrote: > > Maybe it'd be better to change temp table removal to always drop > > max_locks_per_transaction objects at a time (ie. commit/start a new > > transaction every so many objects). > > We're basically just doing DROP SCHEMA ... CASCADE, so I'm not sure > how we'd implement that, but I agree it would be significantly better. (Minor nit: even currently, we don't drop the schema itself, only the objects it contains.) I was thinking we could scan pg_depend for objects depending on the schema, add them to an ObjectAddresses array, and do performMultipleDeletions once every max_locks_per_transaction objects. But in order for this to have any useful effect we'd have to commit the transaction and start another one; maybe that's too onerous. Maybe we could offer such a behavior as a special case to be used only in case the regular mechanism fails. So add a PG_TRY which, in case of failure, sends a hint to do the cleanup. Not sure this is worthwhile. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services