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 1m8aI3-0006GB-47 for pgsql-performance@arkaria.postgresql.org; Wed, 28 Jul 2021 03:31:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m8aI1-0004ni-I2 for pgsql-performance@arkaria.postgresql.org; Wed, 28 Jul 2021 03:31:25 +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 1m8aI1-0004na-9e for pgsql-performance@lists.postgresql.org; Wed, 28 Jul 2021 03:31:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8aHz-0003h2-EK for pgsql-performance@postgresql.org; Wed, 28 Jul 2021 03:31:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 16S3VHFG544432; Tue, 27 Jul 2021 23:31:17 -0400 From: Tom Lane To: "ldh@laurent-hasson.com" cc: Peter Geoghegan , David Rowley , Justin Pryzby , "pgsql-performance@postgresql.org" Subject: Re: Big performance slowdown from 11.2 to 13.3 In-reply-to: <543673.1627442152@sss.pgh.pa.us> References: <20210721191528.GC19620@telsasoft.com> <732758.1626911007@sss.pgh.pa.us> <784576.1626968702@sss.pgh.pa.us> <785218.1626969409@sss.pgh.pa.us> <786600.1626970898@sss.pgh.pa.us> <787780.1626972122@sss.pgh.pa.us> <171155.1627236507@sss.pgh.pa.us> <543673.1627442152@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 27 Jul 2021 23:15:52 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <544430.1627443077.1@sss.pgh.pa.us> Date: Tue, 27 Jul 2021 23:31:17 -0400 Message-ID: <544431.1627443077@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > Yeah, I wouldn't sweat over the specific value. The pre-v13 behavior > was effectively equivalent to hash_mem_multiplier = infinity, so if > you weren't having any OOM problems before, just crank it up. Oh, wait, scratch that: the old executor's behavior is accurately described by that statement, but the planner's is not. The planner will not pick a hashagg plan if it guesses that the hash table would exceed the configured limit (work_mem before, now work_mem times hash_mem_multiplier). So raising hash_mem_multiplier to the moon might bias the v13 planner to pick hashagg plans in cases where earlier versions would not have. This doesn't describe your immediate problem, but it might be a reason to not just set the value as high as you can. BTW, this also suggests that the planner is underestimating the amount of memory needed for the hashagg, both before and after. That might be something to investigate at some point. regards, tom lane