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 1jubE7-0006sE-H3 for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jul 2020 12:37: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 1jubE6-0005es-Bv for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jul 2020 12:37:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jubE6-0005ek-4u for pgsql-hackers@lists.postgresql.org; Sun, 12 Jul 2020 12:37:02 +0000 Received: from mail-ej1-x643.google.com ([2a00:1450:4864:20::643]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jubDz-0007PH-Ad for pgsql-hackers@postgresql.org; Sun, 12 Jul 2020 12:37:00 +0000 Received: by mail-ej1-x643.google.com with SMTP id rk21so11145098ejb.2 for ; Sun, 12 Jul 2020 05:36:55 -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:content-transfer-encoding:in-reply-to; bh=wLXiqHCuojFNKGkizq6id2Kn0pq+aVTmoa+xFvzSzNg=; b=s8giyEW8fZwMRWD9Dapv2e8wfcMk2TnqvCxcwQkQ9U/DGCqmkisIGuCa91vJZgE3r4 KeqPYM9eiX8yMHTKiIandZ0e28PxZMrQ4M3XmeIZgc2m1qQsTUt4gjZEORC0jRkzSmK/ nOy08ZPUp7a04+mT/vd82lIbDSQSdX6z0Ks2kA6mbZydJfNXBC2tBaao453bO5v4seNL OR+HjGM8be66ElWq06oSw/Iw4X/Upm89jwsTRSEpNlCvCEKmVXONryTUil5mr/9FRdvQ HXNZLPP5Pk0exGOsocBxF/29hmFFbukmW1o1HU2+b4oRCss88mosL1STT3f+kut2HqPP eMfg== 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:content-transfer-encoding :in-reply-to; bh=wLXiqHCuojFNKGkizq6id2Kn0pq+aVTmoa+xFvzSzNg=; b=i77k9MGJJmN4AQYk6WXVnAWiXOeNfIL9vsuo7P4eZwQ0O2KBJNrwkKbY1GI/6XltyO GDk7AMQ1VyOrdf7eZQrM2xdIAEddBOl4ckgvRV536kcTTkr8XYQfweUdPe35RWw5et0m MivbVzgIPmr9LX28DZXhk1zMWaSxKnOT+yqCcn5V9G4M9gbTBiMZ3h5st6X/i82zd1Nz TvJZPyXzRgVudCUvFHhftgB9LwcFm414HupmEjhnCWdRC9aqsb65GVJ673wkvZyVRuCk lUz2BzWKKoTJIc+2rjSzOBR63MEmCu3veui7oM47MKPBLb0BghzvMpnyKtlnF2Syb+XW KfWg== X-Gm-Message-State: AOAM532Bcpi1BN4JrJ9gnFZDBxVj8YRJdlsxAP7EwWj88XUwI3ibxxiq 8i8TgqYBnIjkT0uDVElVm7oE4Q== X-Google-Smtp-Source: ABdhPJyyGNMBuC4lMGMXHtjDL7KFuhg8Ruzp7lywIDEeTZp6IgdoQ8414d1orA+p4u0ztXZd0OlBoA== X-Received: by 2002:a17:906:6897:: with SMTP id n23mr66963475ejr.473.1594557413912; Sun, 12 Jul 2020 05:36:53 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id s18sm7758030ejm.16.2020.07.12.05.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 05:36:51 -0700 (PDT) Date: Sun, 12 Jul 2020 14:36:48 +0200 From: Tomas Vondra To: "David G. Johnston" Cc: Tom Lane , Stephen Frost , Peter Geoghegan , Jeff Davis , Alvaro Herrera , Andres Freund , Bruce Momjian , Robert Haas , David Rowley , Justin Pryzby , Melanie Plageman , "pgsql-hackers@postgresql.org" Subject: Re: Default setting for enable_hashagg_disk Message-ID: <20200712123648.js76j6ablk5nbxpo@development> References: <20200710215012.GN12375@tamriel.snowman.net> <2165606.1594418399@sss.pgh.pa.us> <20200711142213.GP12375@tamriel.snowman.net> <20200712003037.wzrcltujwzwiwlfr@development> <2463591.1594514874@sss.pgh.pa.us> <2474392.1594528628@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Jul 11, 2020 at 10:26:22PM -0700, David G. Johnston wrote: >On Saturday, July 11, 2020, Tom Lane wrote: > >> "David G. Johnston" writes: >> > On Sat, Jul 11, 2020 at 5:47 PM Tom Lane wrote: >> >> It seems like a lot of the disagreement here is focused on Peter's >> >> proposal to make hash_mem_multiplier default to 2.0. But it doesn't >> >> seem to me that that's a critical element of the proposal. Why not just >> >> make it default to 1.0, thus keeping the default behavior identical >> >> to what it is now? >> >> > If we don't default it to something other than 1.0 we might as well just >> > make it memory units and let people decide precisely what they want to >> use >> > instead of adding the complexity of a multiplier. >> >> Not sure how that follows? The advantage of a multiplier is that it >> tracks whatever people might do to work_mem automatically. > > >> >I was thinking that setting -1 would basically do that. > I think Tom meant that the multiplier would automatically track any changes to work_mem, and adjust the hash_mem accordingly. With -1 (and the GUC in units) you could only keep it exactly equal to work_mem, but then as soon as you change it you'd have to update both. >> In general >> I'd view work_mem as the base value that people twiddle to control >> executor memory consumption. Having to also twiddle this other value >> doesn't seem especially user-friendly. > > >I’ll admit I don’t have a feel for what is or is not user-friendly when >setting these GUCs in a session to override the global defaults. But as >far as the global defaults I say it’s a wash between (32mb, -1) -> (32mb, >48mb) and (32mb, 1.0) -> (32mb, 1.5) > >If you want 96mb for the session/query hash setting it to 96mb is >invariant, whilesetting it to 3.0 means it can change in the future if the >system work_mem changes. Knowing the multiplier is 1.5 and choosing 64mb >for work_mem in the session is possible but also mutable and has >side-effects. If the user is going to set both values to make it invariant >we are back to it being a wash. > >I don’t believe using a multiplier will promote better comprehension for >why this setting exists compared to “-1 means use work_mem but you can >override a subset if you want.” > >Is having a session level memory setting be mutable something we want to >introduce? > >Is it more user-friendly? > I still think it should be in simple units, TBH. We already have somewhat similar situation with cost parameters, where we often say that seq_page_cost = 1.0 is the baseline for the other cost parameters, yet we have not coded that as multipliers. >>> If we find that's a poor default, we can always change it later; >> >> but it seems to me that the evidence for a higher default is >> >> a bit thin at this point. >> >> > So "your default is 1.0 unless you installed the new database on or after >> > 13.4 in which case it's 2.0"? >> >> What else would be new? See e.g. 848ae330a. (Note I'm not suggesting >> that we'd change it in a minor release.) >> > >Minor release update is what I had thought, and to an extent was making >possible by not using the multiplier upfront. > >I agree options are wide open come v14 and beyond. > >David J. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services