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 1joWL4-0004H3-Uv for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jun 2020 18:11:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1joWL3-0005hh-Sw for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jun 2020 18:11:05 +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 1joWL3-0005ha-M4 for pgsql-hackers@lists.postgresql.org; Thu, 25 Jun 2020 18:11:05 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1joWL1-0005aI-O5 for pgsql-hackers@postgresql.org; Thu, 25 Jun 2020 18:11:05 +0000 Received: by mail-pf1-x42a.google.com with SMTP id x207so3394608pfc.5 for ; Thu, 25 Jun 2020 11:11:03 -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:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=ja/QpyEr1Cmfv2UxgQt9qrYIq6BwZL0zxsiWvUEeXjw=; b=DMvAEQ5sbjqagpNLMUP1e7GDG4kRfhyv7rlz69g0F9ek9GFdLvA6h0UxPOph+J3kCY u3m2u0EpcgcNSUbxXAOVtNkp3gTi3BEK9uizrERgXmuJXcHvDji/hLfL5PJ5cTcDDyeq LGJqf3pkmkNWPGXm9EtwzBGgscUiVgKlgBYFg1ZikWriK2vSKDqe476AHGbiSaDJ4VG+ rJWWv8DsTODGSVyDOBUXlDSZQZsV4BVHIGJ8pG7koOx4cUIlI+GRYuXWuqnvDOyw/Beq cqul5BTkfbvmZxAhMCR6/6jkHw9Pxmkp9kIy6x+mLqoo60VoFqMjKiFqQSCeZRNJkcpw I4vQ== 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:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=ja/QpyEr1Cmfv2UxgQt9qrYIq6BwZL0zxsiWvUEeXjw=; b=kx7q1klLLGGLHwTy1dq/l1FnK8UKtQrj1aN3dFMtB9QK81hrbohGlBNDpL0ASLUBqS Q3ty1bL6W7JvkpIwj8xx/bdxESIi8xKgoi8OitI51gr0o4psz76Fs91e+6BN8VoqPPxb 9wmI846Ct/ZoGvIW+gQDSqSS4dpv6GJKqBccim6ZQlTb4hDU7mk6+D/QxldQFYKndbDE d+jo+pwF9XhjcSkQWWKnPePu9dq+z7ZNkXCqTHyxEz7P4jVhuqa4YGinCYNKHFF2hQVE 6AzKUCwBPuWLZn+fIQ2hz0Bsyz9iLhtRRLf/qnUJ8MKB4NLNPfRGOAX9+Ayboouveqg2 rLCw== X-Gm-Message-State: AOAM5326T9cQFyktNc8qXpe9IlJdSyCx+0mP91GWbnbOzNm2KtQ45CFx w70SSXCGB+XXeWEtxbulDl1CVQ== X-Google-Smtp-Source: ABdhPJzvmH8U3GZ+Z9GpL7h90rEhY/bPhV5ZMNwWYgnov9mIxQ26Go9cQnEvicDxmmj18OlIYrMbaQ== X-Received: by 2002:a62:75cc:: with SMTP id q195mr35203242pfc.256.1593108661392; Thu, 25 Jun 2020 11:11:01 -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 a29sm23517637pfg.201.2020.06.25.11.10.59 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Jun 2020 11:11:00 -0700 (PDT) Message-ID: Subject: Re: Default setting for enable_hashagg_disk From: Jeff Davis To: Tom Lane , Justin Pryzby Cc: Bruce Momjian , David Rowley , Robert Haas , Melanie Plageman , Tomas Vondra , pgsql-hackers@postgresql.org Date: Thu, 25 Jun 2020 11:10:58 -0700 In-Reply-To: <2214502.1593019796@sss.pgh.pa.us> References: <6292f5a766198d5745eb8cc17ac736366056671d.camel@j-davis.com> <20200610021544.GA14879@telsasoft.com> <8bff2e4e8020c3caa16b61a46918d21b573eaf78.camel@j-davis.com> <129c8f1739957589584d9525e1d8782eae3f412f.camel@j-davis.com> <20200624090628.GA19640@momjian.us> <20200624123843.GX4107@telsasoft.com> <2214502.1593019796@sss.pgh.pa.us> 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 Wed, 2020-06-24 at 13:29 -0400, Tom Lane wrote: > If we feel we need something to let people have the v12 behavior > back, let's have > (1) enable_hashagg on/off --- controls planner, same as it ever was > (2) enable_hashagg_spill on/off --- controls executor by disabling > spill > > But I'm not really convinced that we need (2). If we're not going to have a planner GUC, one alternative is to just penalize the disk costs of HashAgg for a release or two. It would only affect the cost of HashAgg paths that are expected to spill, which weren't even generated in previous releases. In other words, multiply the disk costs by enough that the planner will usually not choose HashAgg if expected to spill unless the average group size is quite large (i.e. there are a lot more tuples than groups, but still enough groups to spill). As we learn more and optimize more, we can reduce or eliminate the penalty in a future release. I'm not sure exactly what the penalty would be, though. Regards, Jeff Davis