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 1jo4g7-0003S5-6c for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Jun 2020 12:38:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jo4g5-0001cq-8Y for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Jun 2020 12:38:57 +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 1jo4g4-0001cj-SI for pgsql-hackers@lists.postgresql.org; Wed, 24 Jun 2020 12:38:57 +0000 Received: from mail-io1-xd43.google.com ([2607:f8b0:4864:20::d43]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jo4fx-0006Ng-5w for pgsql-hackers@postgresql.org; Wed, 24 Jun 2020 12:38:55 +0000 Received: by mail-io1-xd43.google.com with SMTP id c16so1906985ioi.9 for ; Wed, 24 Jun 2020 05:38:48 -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=lHr0mi68XwCyj9pDiHALcbHqooYSXFCfqyqUEi73TDQ=; b=MzJIC61XBKbRkGi83XGcAnnDYRHU01ZHPF8ZviUbP7EEmsqBHtvaMlIkBq4ptUknWx /Y1JekazG382sZ+yqNbRUUB744zRnH9MDoZbJ0SjkCMmU+Io41cBIslPY7VeMZCGfsMq YIHCpuy5iGgRYCVWM4BpI6yJ4O3+rMigutH1qGU43GL5Z7UeLS4yJXvq0Y4EW7ibdFVN Du8doYHU2y2qFdej2DosSZ7pxKyLWqLloWSVfqy3H8cszquNPI6IjDHoACJxo5W2By+V TdXQVFS04YU1UQOnlgsyWxJaZkwJgCp+itwhuWrS6f9+mwPi43yLjWFSd15DotYbLhW1 4HJg== 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=lHr0mi68XwCyj9pDiHALcbHqooYSXFCfqyqUEi73TDQ=; b=bWXadVS+qVAivHi0/Fr3c2uqQsHeWU/pNQAOLyB8m1JhbWIHMhJJoECveyoEIfU6nH Jj7nt263tXPXtFpudQdwnvlQqyjP1H80j8f1pS+3VwfBFeBnMJgqNNlJIislYELPHOsu 9XAINIUrenwH/NhQfrBIoC5z9rZYZzgbMkBm7+Hv1Lf59tH3AzRPqjumm73CCsk9LuPa cNqgw/4Yinhof3U89tWobNgAgOxPFGGSlE3qO7BQ0h1MyKODcv1SKaLNgGCAfw6RpZ6N Cg6jfiG2kDkpUHq3UNERYUTDPGMugye8jS63l+elaAxmGtBMcq+vywSGtmx+cuJ8KGW1 9sOg== X-Gm-Message-State: AOAM531L3eiX7AV9C8v3+GZey2e6JygY7eTfS4QgSmn7hzrxeDI2TdvK 94fVvWqFNdZu0xHMWZuO8cPfwQ== X-Google-Smtp-Source: ABdhPJxEHB3LCW+Ctn4JtmuXQp0zJ9oE1x0/XQkexOZnJIKw974mzQC1aiFAXY6EZHCVffBZ6UaKzQ== X-Received: by 2002:a6b:e903:: with SMTP id u3mr14168203iof.201.1593002326535; Wed, 24 Jun 2020 05:38:46 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id b24sm10125959ioh.6.2020.06.24.05.38.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jun 2020 05:38:45 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id B34C780011E; Wed, 24 Jun 2020 07:38:43 -0500 (CDT) Date: Wed, 24 Jun 2020 07:38:43 -0500 From: Justin Pryzby To: Bruce Momjian Cc: David Rowley , Jeff Davis , Robert Haas , Melanie Plageman , Tomas Vondra , pgsql-hackers@postgresql.org Subject: Re: Default setting for enable_hashagg_disk Message-ID: <20200624123843.GX4107@telsasoft.com> References: <6292f5a766198d5745eb8cc17ac736366056671d.camel@j-davis.com> <20200610021544.GA14879@telsasoft.com> <8bff2e4e8020c3caa16b61a46918d21b573eaf78.camel@j-davis.com> <129c8f1739957589584d9525e1d8782eae3f412f.camel@j-davis.com> <20200624090628.GA19640@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200624090628.GA19640@momjian.us> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Jun 24, 2020 at 05:06:28AM -0400, Bruce Momjian wrote: > On Wed, Jun 24, 2020 at 02:11:57PM +1200, David Rowley wrote: > > On Tue, 23 Jun 2020 at 08:24, Jeff Davis wrote: > > > Another way of looking at it is that the weird behavior is already > > > there in v12, so there are already users relying on this weird behavior > > > as a crutch for some other planner mistake. The question is whether we > > > want to: > > > > > > (a) take the weird behavior away now as a consequence of implementing > > > disk-based HashAgg; or > > > (b) support the weird behavior forever; or > > > (c) introduce a GUC now to help transition away from the weird behavior > > > > > > The danger with (c) is that it gives users more time to become more > > > reliant on the weird behavior; and worse, a GUC could be seen as an > > > endorsement of the weird behavior rather than a path to eliminating it. > > > So we could intend to do (c) and end up with (b). We can mitigate this > > > with documentation warnings, perhaps. > > > > So, I have a few thoughts on this subject. I understand both problem > > cases have been mentioned before on this thread, but just to reiterate > > the two problem cases that we really would rather people didn't hit. > > I appreciated this summary since I wasn't fully following the issues. > > > As for GUCs to try to help the group of users who, *I'm certain*, will > > have problems with PG13's plan choice. I think the overloaded > > enable_hashagg option is a really nice compromise. We don't really > > have any other executor node type that has multiple GUCs controlling > > its behaviour, so I believe it would be nice to keep it that way. ... > It would seem merge join has almost the same complexities as the new > hash join code, since it can spill to disk doing sorts for merge joins, > and adjusting work_mem is the only way to control that spill to disk. I > don't remember anyone complaining about spills to disk during merge > join, so I am unclear why we would need a such control for hash join. It loooks like merge join was new in 8.3. I don't think that's a good analogy, since the old behavior was still available with enable_mergejoin=off. I think a better analogy would be if we now changed sort nodes beneath merge join to use at most 0.5*work_mem, with no way of going back to using 1.0*work_mem. -- Justin