Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bcKAU-0007dG-Bn for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Aug 2016 22:27:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bcKAT-0005nx-PP for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Aug 2016 22:27:37 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bcK95-0004GM-HO for pgsql-hackers@postgresql.org; Tue, 23 Aug 2016 22:26:11 +0000 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bcK92-00056T-5X for pgsql-hackers@postgresql.org; Tue, 23 Aug 2016 22:26:10 +0000 Received: by mail-wm0-x22e.google.com with SMTP id q128so180190205wma.1 for ; Tue, 23 Aug 2016 15:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=DwVLRQASUlLIlRfjUBzbb5fvYa2ikZsPXIucwDXD/NI=; b=rpLboy8r4CHgqEM8TKp6Pw/k2K1NinDVgT8x6+XqW+hUoeen8RE/eorRdMOT2+bESc V2EOjqPRZ8ZagHUIuadOXfTOelF1hpLgL/YySr8mC+GUoSHF7c73SxUKl4eYl8rfDska tKXUTM3CBVqr7dMPsjssBdvQX6bOiTTSWQqEuWd+wuLqPqLrybB/nD7L+TR2Iw7fObwh fWxC4L/Brf8R0ndPmeARSKCKPWWRnkQXeYzE7O6sNO26bXXnvHu0UuyxU5lOcJsGccX0 wu1cjWsA/FV0GiyOTLTJ5t8ptcdwkbXIF7QIV8Kt7rbbUUPKvt7U2yPN2SvxIfN7zMI2 sJOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=DwVLRQASUlLIlRfjUBzbb5fvYa2ikZsPXIucwDXD/NI=; b=TzU6Rm8I7oU+MIkJoh5+YsubAKS1inKCXMWJYD5PsNLKi9lGrkiwvcLfFdweKlLs69 zxh/DngDrwj7xfx0Ua3W8ZGhTk6e1NpcrSzy6nazkxDrMjuJNoDjdwyTNalOPHM6SX7/ zTt/QgqO9q99ElkzDjj4ChL7WbKGfnsuzTlp7eXJUEDzDGqdjj2B7+NaWF+bBn5gQPm+ HnT+50u5SfFZBnOh8oYB7dnD35cfO/BamGYmAI8Q95VrxE3yMJxo/PwHnAvx80/JnTMG oxqrC1EXzXMHWOfWjifnmJ/sHE2seTTYU7zXQ4g9RDu2OSo/otEeI+tkmNnrXHA+1KLN 3dRw== X-Gm-Message-State: AEkooutTR/IFnVm3jq3hG8uOdV9UAkSZMg5a6LInShxOlPbI/7i/iOr3iV375gMMxmqvtfIgYmJo30YetJAJqZ3vAdMrkwZ4AZzXPP7a518RdtmG4GQ8PFlGLSMjnvSL8zkwCs5dsAJR1byHnP6YnQ5FElZif9BGOKv0vkPRhNzCMpVK0+RipLu3xnhaDq3pqDD81Z+IVVkQ X-Received: by 10.28.16.3 with SMTP id 3mr22433377wmq.58.1471991167276; Tue, 23 Aug 2016 15:26:07 -0700 (PDT) Received: from [10.137.2.20] (178-253-200-198.adsl-a-10.sezampro.rs. [178.253.200.198]) by smtp.gmail.com with ESMTPSA id bw9sm6207532wjc.33.2016.08.23.15.25.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Aug 2016 15:26:06 -0700 (PDT) Subject: Re: [Patch] Temporary tables that do not bloat pg_catalog (a.k.a fast temp tables) To: Claudio Freire References: <20160801124531.66cde374@fujitsu> <26c3bc60-6613-e7ab-517a-53136f01fb6c@2ndquadrant.com> <13191.1470072250@sss.pgh.pa.us> <20160804151451.6fb87507@fujitsu> <14212.1470595566@sss.pgh.pa.us> <20160815005755.gswdyjfob7dzw4yp@alap3.anarazel.de> <20319.1471223097@sss.pgh.pa.us> <20160815010852.5ijua2wm2edzimd4@alap3.anarazel.de> <20160815121216.46bd758d@e733> <95bdc353-1a89-3fe3-1181-eba558c4df83@BlueTreble.com> Cc: Robert Haas , Jim Nasby , Aleksander Alekseev , PostgreSQL Hackers From: Tomas Vondra Message-ID: <40e4f58f-6cd9-01b0-2cc1-67dcb71a5d61@2ndquadrant.com> Date: Wed, 24 Aug 2016 00:25:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Thunderbird/46.0a2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 On 08/24/2016 12:18 AM, Claudio Freire wrote: > On Tue, Aug 23, 2016 at 7:11 PM, Tomas Vondra > wrote: >> On 08/22/2016 10:32 PM, Robert Haas wrote: >>> >>> >>> ... >>> >>> 1. The number of tables for which we would need to add a duplicate, >>> unlogged table is formidable. You need pg_attribute, pg_attrdef, >>> pg_constraint, pg_description, pg_type, pg_trigger, pg_rewrite, etc. >>> And the backend changes needed so that we used the unlogged copy for >>> temp tables and the permanent copy for regular tables is probably >>> really large. >>> >>> 2. You can't write to unlogged tables on standby servers, so this >>> doesn't help solve the problem of wanting to use temporary tables on >>> standbys. >>> >>> 3. While it makes creating temporary tables a lighter-weight >>> operation, because you no longer need to write WAL for the catalog >>> entries, there's probably still substantially more overhead than just >>> stuffing them in backend-local RAM. So the performance benefits are >>> probably fairly modest. >>> >>> Overall I feel like the development effort that it would take to make >>> this work would almost certainly be better-expended elsewhere. But of >>> course I'm not in charge of how people who work for other companies >>> spend their time... >>> >> >> Could someone please explain how the unlogged tables are supposed to fix the >> catalog bloat problem, as stated in the initial patch submission? We'd still >> need to insert/delete the catalog rows when creating/dropping the temporary >> tables, causing the bloat. Or is there something I'm missing? > > Wouldn't more aggressive vacuuming of catalog tables fix the bloat? > > Perhaps reserving a worker or N to run only on catalog schemas? > > That'd be far simpler. Maybe, although IIRC the issues with catalog bloat were due to a combination of long queries and many temporary tables being created/dropped. In that case simply ramping up autovacuum (or even having a dedicated workers for catalogs) would not realy help due to the xmin horizon being blocked by the long-running queries. Maybe it's entirely crazy idea due to the wine I drank at the dinner, but couldn't we vacuum the temporary table records differently? For example, couldn't we just consider them removable as soon as the backend that owns them disappears? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers