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 1joABu-0005nw-V1 for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Jun 2020 18:32:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1joABt-0006VN-Sn for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Jun 2020 18:32:09 +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 1joABt-0006Sl-LV for pgsql-hackers@lists.postgresql.org; Wed, 24 Jun 2020 18:32:09 +0000 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1joABq-00015G-BP for pgsql-hackers@postgresql.org; Wed, 24 Jun 2020 18:32:08 +0000 Received: by mail-ed1-x542.google.com with SMTP id e22so2223181edq.8 for ; Wed, 24 Jun 2020 11:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Z4hsw/4gTylhfau5pasDsWAgIDOyx9+b68EnSb8FpxI=; b=wsaIY8dMr2nqgQ//3kUBStJPIkgoBAbbhVzl/tdYvHUgxJ/K7ubQ6Zd3bMoyecIPry a8ka1f4XxDGe+FBegXn9ns8D11xBG5Iu09cgARrEGD1RSaT61Hc7uumtWQcTKvV7GOdm ajgS2O9yxlmOcyIFld3uIsPaycb6CAsuG3bs1NMT0Xe7ORSL+2A6V4FS3vHpdBfp+Irg RN+pam3SFupztRN8hhtSb2O7LHUtJ9cPaTzIxZrtRNvfDyt6Z9hnnp38OxlMSyGg/eWP XH8S1tDuFK0SCRJpzMLjirLfovz2whJ7r2wCA795CIceMR2sHfZVU30DTJDh2A+1QCL5 qYzw== 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; bh=Z4hsw/4gTylhfau5pasDsWAgIDOyx9+b68EnSb8FpxI=; b=VM+EMpe2vNH0eIn80soiL20dss9LkRagzuZN3EfZgiyUGtNoi/f2xJnZ0/hgZIHWn7 vQbedEzCFwprqXKqw8bkbUMYCz8Xb8sNq4DfDLpDHRIPdHB6mhHxWOyNL+CzNq5byabY pioX/nszghoOSWjNT4LWUEwTMLxBADethOtGyRf/4GQiE4DlWXapHCZ4cNd1S+Ebbpfi m7jDCcsLA98uFS4LFh7/CYJmxWEurdt3iyAGpcy7sisUKKaDKhXSg3BCQ/sFmiw6cJDu ghCLA/xwyLl0mHeKiPOVq076TuzCeT0XPxONb1csnXdm8++RTYPuQS0Ia/jsSh7V0rd6 N92g== X-Gm-Message-State: AOAM530Ns8Uf63TunWhMJqrh2SYFH8Jd7EaMQFgUh/EW6ZeqB38XyJqo M6oiefRIsXCFpPtT458+j6nfLw== X-Google-Smtp-Source: ABdhPJwb9idBry21ZAJZirLRaKsdb42FbglNtVC+tsOZzNGMm9y/40mOX3d9I9RbaEHbQPiCdP/WZQ== X-Received: by 2002:a05:6402:1d97:: with SMTP id dk23mr9717485edb.1.1593023525334; Wed, 24 Jun 2020 11:32:05 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id q21sm15579474ejd.30.2020.06.24.11.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 11:32:04 -0700 (PDT) Date: Wed, 24 Jun 2020 20:32:03 +0200 From: Tomas Vondra To: Tom Lane Cc: Justin Pryzby , Bruce Momjian , David Rowley , Jeff Davis , Robert Haas , Melanie Plageman , pgsql-hackers@postgresql.org Subject: Re: Default setting for enable_hashagg_disk Message-ID: <20200624183203.cnqcol27ruastit7@development> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <2214502.1593019796@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Jun 24, 2020 at 01:29:56PM -0400, Tom Lane wrote: >Justin Pryzby writes: >> On Wed, Jun 24, 2020 at 05:06:28AM -0400, Bruce Momjian wrote: >>> 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. > >Uh, what? A look into our git history shows immediately that >nodeMergejoin.c has been there since the initial code import in 1996. > >I tend to agree with Bruce that it's not very obvious that we need >another GUC knob here ... especially not one as ugly as this. >I'm especially against the "neverspill" option, because that makes a >single GUC that affects both the planner and executor independently. > >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 > What if a user specifies enable_hashagg = on enable_hashagg_spill = off and the estimates say the hashagg would need to spill to disk. Should that disable the query (in which case the second GUC affects both executor and planner) or run it (in which case we knowingly ignore work_mem, which seems wrong). regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services