Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jux0Z-0006IG-2q for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Jul 2020 11:52:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jux02-0007ww-CH for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Jul 2020 11:51:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jux01-0007wo-GP for pgsql-hackers@lists.postgresql.org; Mon, 13 Jul 2020 11:51:58 +0000 Received: from wforward2-smtp.messagingengine.com ([64.147.123.31]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1juwzs-0001zm-Sp for pgsql-hackers@postgresql.org; Mon, 13 Jul 2020 11:51:56 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.west.internal (Postfix) with ESMTP id AEA9F8A2; Mon, 13 Jul 2020 07:51:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 13 Jul 2020 07:51:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=iUz68e+RNzOIZe1LNhZy3k/CJsYLUtBJLxS7R7utA 6c=; b=YihLyqP9ksNOwlGAM051Vf2qVxhJ51rb2drGMfxMi3HYXUr4MbuGUziUg wnFD7UPAcLlSSKK1pbsYG2ULoAUpwmsMcbsxUCJSiwe8lA5w8AMbLwdfunfFS9xX D2UE62JcykdTFPs4XqKhs1W5rWtBtGRk7rspX4nmUZ6mUTr7zYubt1WqeGBQCtFw x+fnuFy2fsy396C08XP/jytNlVs+cFPVSDZmPZXqxHbfuvsxlxGlRd19dKOChGo7 zRMSDES+X4ba4e7OvJsxJmapfO0P+PIeslebWbr9NBPUhAde5OX//k0kqPZh3Ksq K+sLh6Hiy5uBxkxBjbzlJHIubV6zQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrvdekgdeghecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhohfkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghr rdgvihhsvghnthhrrghuthesvdhnughquhgrughrrghnthdrtghomheqnecuggftrfgrth htvghrnheptdevgeehtdejvdevvdeljeeuveejjedtleelgfekleefieekjeelgfektddu uedvnecuffhomhgrihhnpedvnhguqhhurggurhgrnhhtrdgtohhmnecukfhppeelfedrvd egfedrudeluddrvdefkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghuthesvdhnughquhgrughrrghnth drtghomh X-ME-Proxy: Received: from april.pezone.net (p5df3bfee.dip0.t-ipconnect.de [93.243.191.238]) by mail.messagingengine.com (Postfix) with ESMTPA id 7984F328005D; Mon, 13 Jul 2020 07:51:44 -0400 (EDT) Subject: Re: Default setting for enable_hashagg_disk To: Jeff Davis , pgsql-hackers@postgresql.org References: <9d9d1e1252a52ea1bad84ea40dbebfd54e672a0f.camel@j-davis.com> From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <55a29622-b5c7-8cc5-3a49-0bf89d0bb92e@2ndquadrant.com> Date: Mon, 13 Jul 2020 13:51:42 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <9d9d1e1252a52ea1bad84ea40dbebfd54e672a0f.camel@j-davis.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-04-07 20:20, Jeff Davis wrote: > Now that we have Disk-based Hash Aggregation, there are a lot more > situations where the planner can choose HashAgg. The > enable_hashagg_disk GUC, if set to true, chooses HashAgg based on > costing. If false, it only generates a HashAgg path if it thinks it > will fit in work_mem, similar to the old behavior (though it wlil now > spill to disk if the planner was wrong about it fitting in work_mem). > The current default is true. I have an anecdote that might be related to this discussion. I was running an unrelated benchmark suite. With PostgreSQL 12, one query ran out of memory. With PostgreSQL 13, the same query instead ran out of disk space. I bisected this to the introduction of disk-based hash aggregation. Of course, the very point of that feature is to eliminate the out of memory and make use of disk space instead. But running out of disk space is likely to be a worse experience than running out of memory. Also, while it's relatively easy to limit memory use both in PostgreSQL and in the kernel, it is difficult or impossible to limit disk space use in a similar way. I don't have a solution or proposal here, I just want to mention this as a possibility and suggest that we look out for similar experiences. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services