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 1jtgkp-0005Zk-Ee for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Jul 2020 00:19:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jtgkn-0004RX-EA for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Jul 2020 00:19:01 +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 1jtgkn-0004RQ-2U for pgsql-hackers@lists.postgresql.org; Fri, 10 Jul 2020 00:19:01 +0000 Received: from mail-il1-x141.google.com ([2607:f8b0:4864:20::141]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jtgki-00024v-Si for pgsql-hackers@postgresql.org; Fri, 10 Jul 2020 00:19:00 +0000 Received: by mail-il1-x141.google.com with SMTP id t4so3629833iln.1 for ; Thu, 09 Jul 2020 17:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=07GKzEUMFgoRzsNQkELeWxzToH00ss1MjGL5MpkJwd0=; b=hfSxtmr4Hd9uHq7A1cjKfaGupIG1dGwUKWuVslb0aitT5PuB4x85HxrvXm350IFzwq vFZxY98LOBFxyqdEtYt++CBYQwFxxHtO/aMtrUlCkOyi9bNbMv7RlYsxFACpXYK+ENPF BtDJyg/qXi67C2e2P0oMjO/9kgc6YTvNBQcJUxxdJ7tj1EHELdFMo4BcfBDGTwrAvjyC a/qlqN2mkfEIVEFNCDyIZWUmhiVRvY1EsLSn/0RrUSlSa+mDdVKWZQkGyk0yNd4vG3kb tDTP+7JZFBy/XgTZI5MNknT4/ba9Eh6amcZEejoBk84muzItqH4axnO7RG2Rx3485XL5 G9Nw== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=07GKzEUMFgoRzsNQkELeWxzToH00ss1MjGL5MpkJwd0=; b=i2eEab2CBSIX/hMj1eKiunKGtG19eH5gjhvTkEFsU7/SHpM5sXSpWC19GpjvA0V7HQ zilB1yMVtzWP+8lxwbAGVQ0DLx7+BenWFec22l0PP6KNZhjk0XpsMmMR9afV2TaZ1vKK Ld1ZWLGh5yFbssSWtnec+KYfSOZlvXvbwOH2PLPOcDq/Gx58ARorsblGDdqWBHtn1GPQ 46QO7DM+uJ71/n5DalDI8RN1HHw1NnBBa7MQH1ulRj9hD+T04DIT/JbhMJREj1FUMPPf 9BW+t7SUxjn62BpmM0q5h47IiaHMLHoxPcNIS1sh8ST8fxz/tkVo+ScF2LF4SjT4gJmO wmlw== X-Gm-Message-State: AOAM533a22VyJI/BqMoNh58IeNbgcPQuGGFcq3qdBBa+xI+Dc79Mj0z4 9mcCT/r0AF/eZWe0MS9KVhLtdQ== X-Google-Smtp-Source: ABdhPJzno4kCU9UjYt5Sy8L6bO+LAuUeqXBXCPvrhxO8EmVwIMtfpmxelsg4y4lGEf9LMh1ESr0wKA== X-Received: by 2002:a92:1814:: with SMTP id 20mr50978682ily.81.1594340335112; Thu, 09 Jul 2020 17:18:55 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id p11sm2693482ilb.55.2020.07.09.17.18.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2020 17:18:53 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id ADA14800BBA; Thu, 9 Jul 2020 19:18:52 -0500 (CDT) Date: Thu, 9 Jul 2020 19:18:52 -0500 From: Justin Pryzby To: Stephen Frost Cc: Peter Geoghegan , Jeff Davis , Alvaro Herrera , Andres Freund , Bruce Momjian , Robert Haas , David Rowley , Melanie Plageman , Tomas Vondra , pgsql-hackers@postgresql.org Subject: Re: Default setting for enable_hashagg_disk Message-ID: <20200710001852.GC26220@telsasoft.com> References: <85F9F4F0-918A-457F-BC9E-F2AC2EFC1F86@anarazel.de> <20200625225853.GA11137@alvherre.pgsql> <20200708140037.GI3125@tamriel.snowman.net> <99b047386525b87df1e611335c2e57a6cdef346b.camel@j-davis.com> <20200709140330.GO3125@tamriel.snowman.net> <20200709225840.GE12375@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200709225840.GE12375@tamriel.snowman.net> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Jul 09, 2020 at 06:58:40PM -0400, Stephen Frost wrote: > * Peter Geoghegan (pg@bowt.ie) wrote: > > On Thu, Jul 9, 2020 at 7:03 AM Stephen Frost wrote: > > It makes more sense than simply ignoring what our users will see as a > > simple regression. (Though I still lean towards fixing the problem by > > introducing hash_mem, which at least tries to fix the problem head > > on.) > > The presumption that this will always end up resulting in a regression > really doesn't seem sensible to me. Nobody said "always" - we're concerned about a fraction of workloads which regress, badly affecting only only a small fraction of users. Maybe pretend that Jeff implemented something called CashAgg, which does everything HashAgg does but implemented from scratch. Users would be able to tune it or disable it, and we could talk about removing HashAgg for the next 3 years. But instead we decide to remove HashAgg right now since it's redundant. That's a bad way to transition from an old behavior to a new one. It's scary because it imposes a burden, rather than offering a new option without also taking away the old one. > > That's not the only justification. The other justification is that > > it's generally reasonable to prefer giving hash aggregate more memory. > > Sure, and it's generally reasonably to prefer giving Sorts more memory > too... as long as you've got it available. I believe he meant: "it's generally reasonable to prefer giving hash aggregate more memory THAN OTHER NODES" Referencing: https://www.postgresql.org/message-id/CAH2-Wz=YEMOeXdAPwZo7uriR5KPsf_RGuMHvk3HvLDVksdrwHg@mail.gmail.com https://www.postgresql.org/message-id/CAH2-Wznd_wL+Q3sUjLN3o5F6Q5AvHSTYOozPAei2QfuYDSd4fw@mail.gmail.com https://www.postgresql.org/message-id/CAH2-Wz=osB4oi_nH8MnosYhVVSNOm5q3=exGe-b3q6gWOgf98w@mail.gmail.com Peter's patch and David's competing proposal aim to provide a kind of "soft" transition, where the old behavior is still possible (whether default or not). David's proposal (enable_hashagg=neverspill/soft) [0] isn't implemented, but would allow returning *exactly* to the pre-13 behavior (modulo other planner changes). That's a bit of a kludge and we'd hope to eventually remove the neverspill/soft stuff, returning enable_* to boolean. Whereas Peter's hash_mem patch allows returning to the pre-13 behavior if the mem required for hashagg is between work_mem and hash_mem; but, by definition, not if the required mem exceeds hash_mem, in which case it would spill to disk. This has the advantage that it's independently useful and not a transitional kludge. -- Justin [0] Bruce proposed some "naming things" amendments to David's idea: https://www.postgresql.org/message-id/CAApHDvqFZikXhAGW=UKZKq1_FzHy+XzmUzAJiNj6RWyTHH4UfA@mail.gmail.com https://www.postgresql.org/message-id/20200625171756.GB12486@momjian.us