Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qfiRg-00Cqez-4M for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Sep 2023 15:03:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qfiRe-001DVc-MN for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Sep 2023 15:03:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qfiRe-001DVR-4U for pgsql-hackers@lists.postgresql.org; Mon, 11 Sep 2023 15:03:22 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qfiRa-003ytV-Fh for pgsql-hackers@postgresql.org; Mon, 11 Sep 2023 15:03:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=jOn1gNU3CBnVr6cl/tR+OacqFg2u3YSb6k9zHDUd6Qg=; b=zY1Z7 t5lFnKZfVLhykxvGzUtP/EMwVp28Q99v8WlI8Y3n1ndycLHY8mxBP6emcDLezka7nP45IoU8tP12A UkdQSMBZH7phgVpUDi5AUcXmTIH/+KZ8GDFxxOYe0nCFXih+mrPiznaMdqS7Bt6krtJfqqxeY/KKe 7kjkVWarbmTv6+mQ5vf1HTyv38+Wfk+W1qbUSqy+0Jdt9mMB+S2gawkarXKOVwP3kYz1Xkb8vPwI/ kqkS8fdamNddTVCowRnz7iwz+5USko0jES4B61vAXvAydfPmLnuA/a39+ZTtO1GeuSD232x0TOElp 5lgacYzf/DaCzrkLrhn6nT+9B0fYg==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1qfiRW-00GYb3-2r; Mon, 11 Sep 2023 11:03:14 -0400 Date: Mon, 11 Sep 2023 11:03:14 -0400 From: Bruce Momjian To: David Rowley Cc: "Imseih (AWS), Sami" , Tom Lane , Peter Eisentraut , "pgsql-hackers@postgresql.org" Subject: Re: Correct the documentation for work_mem Message-ID: References: <66590882-F48C-4A25-83E3-73792CF8C51F@amazon.com> <3363505.1682097301@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="6ydViZYVebu/Ug2p" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --6ydViZYVebu/Ug2p Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Sep 11, 2023 at 10:02:55PM +1200, David Rowley wrote: > On Sat, 9 Sept 2023 at 14:25, Imseih (AWS), Sami wrote: > > > > > This looks mostly fine to me modulo "sort or hash". I do see many > > > instances of "and/or" in the docs. Maybe that would work better. > > > > "sort or hash operations at the same time" is clear explanation IMO. > > Just for anyone else following along that haven't seen the patch. The > full text in question is: > > + Note that a complex query might perform several sort or hash > + operations at the same time, with each operation generally being > > It's certainly not a show-stopper. I do believe the patch makes some > improvements. The reason I'd prefer to see either "and" or "and/or" > in place of "or" is because the text is trying to imply that many of > these operations can run at the same time. I'm struggling to > understand why, given that there could be many sorts and many hashes > going on at once that we'd claim it could only be one *or* the other. > If we have 12 sorts and 4 hashes then that's not "several sort or hash > operations", it's "several sort and hash operations". Of course, it > could just be sorts or just hashes, so "and/or" works fine for that. Yes, I see your point and went with "and", updated patch attached. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. --6ydViZYVebu/Ug2p Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="workmem.diff" diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 6bc1b215db..8ed7ae57c2 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1829,9 +1829,10 @@ include_dir 'conf.d' (such as a sort or hash table) before writing to temporary disk files. If this value is specified without units, it is taken as kilobytes. The default value is four megabytes (4MB). - Note that for a complex query, several sort or hash operations might be - running in parallel; each operation will generally be allowed - to use as much memory as this value specifies before it starts + Note that a complex query might perform several sort and hash + operations at the same time, with each operation generally being + allowed to use as much memory as this value specifies before + it starts to write data into temporary files. Also, several running sessions could be doing such operations concurrently. Therefore, the total memory used could be many times the value @@ -1845,7 +1846,7 @@ include_dir 'conf.d' Hash-based operations are generally more sensitive to memory availability than equivalent sort-based operations. The - memory available for hash tables is computed by multiplying + memory limit for a hash table is computed by multiplying work_mem by hash_mem_multiplier. This makes it possible for hash-based operations to use an amount of memory --6ydViZYVebu/Ug2p--