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 1jj5qQ-0003bB-Vf for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jun 2020 18:53:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jj5pu-0000cP-C4 for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jun 2020 18:52:30 +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 1jj5pu-0000cI-4q for pgsql-hackers@lists.postgresql.org; Wed, 10 Jun 2020 18:52:30 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jj5pr-0001bJ-7q for pgsql-hackers@postgresql.org; Wed, 10 Jun 2020 18:52:29 +0000 Received: by mail-pg1-x544.google.com with SMTP id p21so1355307pgm.13 for ; Wed, 10 Jun 2020 11:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:mime-version :content-transfer-encoding; bh=6eFJHhaSbHDwYBpgUDdheWicClJ9AVUIltgBc0i4WDU=; b=OYktO5tKtdx5e3V2GZE1WLiqK0D2IzCBPhOe+zUmjj7cZP490zyiEUQ5KzKYeVk8X9 PfhmJbsR27sCn2b+6+ygEgLEUg+CvkIICF/CHJc3mHxTvdJh/l3OvbNLpMkYooiJa9Yd i0Xzm2aBJ/M6/k+1G9S+D79mT20VkAkVl7/+//UD21cgTqq53wM906Q+agjVOVxnjDGc i4pBsUTn0E8Z6JzMBNFoG46hYdjZniwHzzOXvsKXGodnFU0NBoAfaDIGn6Nw/Ntu7EEx cA2V3P69+SwV9+uF8ZUNfIVgnOg8mbWxMVbfEflbrrLNqxIalN2HxikzjF5TgNvKh0td 5xkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=6eFJHhaSbHDwYBpgUDdheWicClJ9AVUIltgBc0i4WDU=; b=RSlPRimOJ5m9o0SWhf/0SsulHs8d/miaSPD6PElaaW/SGarrVE7wInCQjPbBv1mZwg F4drcu4hG/6ARV7iv9DJY/5Q7Nh7eWtjMdmtNr7Hp99DzRGKMzfrZ8VWrXBqtfXuKG6S FmO24WAsmlE/xmm9sYimY6lluLmnTH5CvIStIFLau4VSSnpbbV86TGBfh1y5v4KOU3ZC mplYEvBNxjOGNEDjXC+/KAi9qy9rmPki9+ryqt+ceLdJ5bKZ/atCBnLVOHYvKrxgcaTH FOTOJ44Of9zU8t9ZnKgHy0eDwalFeK+Meuftxlt1t7ETKG57Rvy7+7V6KHB93dOpoNCE G1Vg== X-Gm-Message-State: AOAM533PCtD8DZ+z1NCkEnvOUWvTSMknGa0fIq2Bbaez1x0tboVEDP5u eZrmt+w9kKppZXJLVuv5+k6e/vJB+3U= X-Google-Smtp-Source: ABdhPJy/iSdnxYXGes04+PXyaEp+VebMVCnXI2e2k+RhHl5F0Sz53jKAtVvauI0dNOoGMVdGR0Ha9g== X-Received: by 2002:a05:6a00:14ce:: with SMTP id w14mr4047644pfu.121.1591815144732; Wed, 10 Jun 2020 11:52:24 -0700 (PDT) Received: from jdavis.lan (c-73-231-146-4.hsd1.ca.comcast.net. [73.231.146.4]) by smtp.gmail.com with ESMTPSA id fv7sm428267pjb.41.2020.06.10.11.52.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jun 2020 11:52:23 -0700 (PDT) Message-ID: <8f987df8c342482cbc1a84405b6a09c398c52819.camel@j-davis.com> Subject: Re: Default setting for enable_hashagg_disk From: Jeff Davis To: pgsql-hackers@postgresql.org Date: Wed, 10 Jun 2020 11:52:22 -0700 In-Reply-To: <9d9d1e1252a52ea1bad84ea40dbebfd54e672a0f.camel@j-davis.com> References: <9d9d1e1252a52ea1bad84ea40dbebfd54e672a0f.camel@j-davis.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, 2020-04-07 at 11:20 -0700, 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 expect this to be a win in a lot of cases, obviously. But as with > any > planner change, it will be wrong sometimes. We may want to be > conservative and set the default to false depending on the experience > during beta. I'm inclined to leave it as true for now though, because > that will give us better information upon which to base any decision. A compromise may be to multiply the disk costs for HashAgg by, e.g. a 1.5 - 2X penalty. That would make the plan changes less abrupt, and may mitigate some of the concerns about I/O patterns that Tomas raised here: https://www.postgresql.org/message-id/20200519151202.u2p2gpiawoaznsv2@development The issues were improved a lot, but it will take us a while to really tune the IO behavior as well as Sort. Regards, Jeff Davis