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 1joafp-0003PY-Lz for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jun 2020 22:48:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1joafo-0002Zc-HI for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jun 2020 22:48:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joafm-0002ZV-TK for pgsql-hackers@lists.postgresql.org; Thu, 25 Jun 2020 22:48:48 +0000 Received: from [66.111.4.29] (helo=out5-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joaff-0004BA-S3 for pgsql-hackers@postgresql.org; Thu, 25 Jun 2020 22:48:45 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id C4B755C00ED; Thu, 25 Jun 2020 18:48:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 25 Jun 2020 18:48:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:in-reply-to:references:mime-version:content-type :content-transfer-encoding:subject:to:cc:from:message-id; s=fm1; bh=kNAYM35SiyuA6/T3baABDzJrMd1oYjYxuSQZ4EH7Eyk=; b=Yf/zn78p55Xh H4OT0H4Mj5iy+WhVhcnisiB6Je04qAS8SN0J7163ctur3z+AOTHSN6P8JFFGp2cd dA8HxP1pW35tYe4spX+pRRggWcdD0AKCXJU4AM9y3/6AtC8PCxhtVWTY3FX7qWBU s33mh5XUzGu8QlHG3Cot6ae2mVfU7KUf+JpB7Iy2iEt5rXsjt7xEkMnJUB4Y7Kfh CrJK5Qu7V0iC6FCKhwR+FGii39q9D2RbV3hJPseG73CFjpgVL1cjfBAKXDHfJ9C8 AyR82jBs8slm+TSp9sHOt1n/KLrV1g6aszcdEZymu6thNzp8S02MeiC4wy5IGl/4 6b9gdW8vHg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=kNAYM35SiyuA6/T3baABDzJrMd1oYjYxuSQZ4EH7E yk=; b=J8P0RAtDzsytupTnAmH7FVWgdBTTxBF7BMIw/tNxfeNxogAI1/zcIJ43B XpMlbia58GRn0FdTgDeSvxUSfZcQTGmBqj+iq0EBrSQjSLjy9zkvAfwKT4HCcy9G HDsowtRpH7Qvf4ZWzzOoTSSYrJgjMiBxojoUbbslQa7/TNvqX51xWvWybjP6PXvA cXiZgtUebJHTJk40XJhNq5Qp0w1R+N9I2+rQYfzkMWgLA5OMl+K3okoIsE6i+wsB KFuNuUexb5drbrnnS3FLJhnIeSSyiL+qDLmG6ywj8krV/Y87HyOMQB/4IqVlQscj yV9qPU9bqABKtNzDqJBUgH4d/2+sQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeltddgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepffgfjghfgggtgffuvffhkfesthhqmhdttderjeenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdehieevvdehvdevfeejfeekfeetheffiefhueegieelvddtueeufeeg jeefjeetnecukfhppeeijedrudeitddrvddujedrvdehtdenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghl rdguvg X-ME-Proxy: Received: from ahand.lan (c-67-160-217-250.hsd1.ca.comcast.net [67.160.217.250]) by mail.messagingengine.com (Postfix) with ESMTPA id C5BA93067848; Thu, 25 Jun 2020 18:48:27 -0400 (EDT) Date: Thu, 25 Jun 2020 15:48:24 -0700 User-Agent: K-9 Mail for Android In-Reply-To: <20200625224422.GA9653@alvherre.pgsql> References: <20200625224422.GA9653@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: Default setting for enable_hashagg_disk To: Alvaro Herrera CC: Bruce Momjian ,Jeff Davis ,Robert Haas ,David Rowley ,Justin Pryzby ,Melanie Plageman ,Tomas Vondra ,"pgsql-hackers@postgresql.org" From: Andres Freund Message-ID: <85F9F4F0-918A-457F-BC9E-F2AC2EFC1F86@anarazel.de> X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.29 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi,=20 On June 25, 2020 3:44:22 PM PDT, Alvaro Herrera wrote: >On 2020-Jun-25, Andres Freund wrote: > >> > What are people doing for those cases already? Do we have an >> > real-world queries that are a problem in PG 13 for this? >>=20 >> I don't know about real world, but it's pretty easy to come up with >> examples=2E >>=20 >> query: >> SELECT a, array_agg(b) FROM (SELECT generate_series(1, 10000)) a(a), >(SELECT generate_series(1, 10000)) b(b) GROUP BY a HAVING >array_length(array_agg(b), 1) =3D 0; >>=20 >> work_mem =3D 4MB >>=20 >> 12 18470=2E012 ms >> HEAD 44635=2E210 ms >>=20 >> HEAD causes ~2=2E8GB of file IO, 12 doesn't cause any=2E If you're IO >> bandwidth constrained, this could be quite bad=2E > >=2E=2E=2E however, you can pretty much get the previous performance back = by >increasing work_mem=2E I just tried your example here, and I get 32 >seconds of runtime for work_mem 4MB, and 13=2E5 seconds for work_mem 1GB >(this one spills about 800 MB); if I increase that again to 1=2E7GB I get >no spilling and 9 seconds of runtime=2E (For comparison, 12 takes 15=2E7 >seconds regardless of work_mem)=2E > >My point here is that maybe we don't need to offer a GUC to explicitly >turn spilling off; it seems sufficient to let users change work_mem so >that spilling will naturally not occur=2E Why do we need more? That's not really a useful escape hatch, because I'll often lead to other = nodes using more memory=2E Andres --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E