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 1qePAk-006iDu-AG for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Sep 2023 00:16:30 +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 1qePAi-005Scf-1U for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Sep 2023 00:16:27 +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 1qePAh-005ScJ-NT for pgsql-hackers@lists.postgresql.org; Fri, 08 Sep 2023 00:16:27 +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 1qePAd-003L3r-Sr for pgsql-hackers@postgresql.org; Fri, 08 Sep 2023 00:16:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; h=In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-ID:Content-Description; bh=cnkO3Dw6tluimfutoDA1rgxF0Is0w8cpqUzJwQvnXZs=; b=q9xidrY2/v77H00F7Drs1xxhQh h+VYkKr9HcpRIXAu2HzUspNEBUnZw/0Frd6s3x36tN6EymjECVhv7ttBE9VkuoxHakjP2AUGKYJCZ 1ZyomQo4Jik67VlZv9vI3sAqtmv4SGbxeItnt/ZAuzDuTfpF4Ni4BwzhqOzWJ4fQ62ZXVWowJ9owg 63Yc1Gj/mg9UPdYraaj0GVicU7Mg/GwKMh+HBfbNJZvDIXpK8Z81I/4+dZA3L42DxYp+ObJ1NMs10 1fkSOTS2G+OATOtjrJ0nIfmrtkpARZdnphJhgZfq5KyADJLPtNF8WSkBdDIcc6KUK5PxKRvFgdcuq Le9COueg==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1qePAb-00HDm2-0T; Thu, 07 Sep 2023 20:16:21 -0400 Date: Thu, 7 Sep 2023 20:16:21 -0400 From: Bruce Momjian To: Tom Lane Cc: Peter Eisentraut , "Imseih (AWS), Sami" , "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="KqmZzgI8Kh67ECZR" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3363505.1682097301@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --KqmZzgI8Kh67ECZR Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Fri, Apr 21, 2023 at 01:15:01PM -0400, Tom Lane wrote: > Peter Eisentraut writes: > > On 21.04.23 16:28, Imseih (AWS), Sami wrote: > >> I suggest a small doc fix: > >> “Note that for a complex query, several sort or hash operations might be > >> running simultaneously;” > > > Here is a discussion of these terms: > > https://takuti.me/note/parallel-vs-concurrent/ > > > I think "concurrently" is the correct word here. > > Probably, but it'd do little to remove the confusion Sami is on about, > especially since the next sentence uses "concurrently" to describe the > other case. I think we need a more thorough rewording, perhaps like > > - Note that for a complex query, several sort or hash operations might be > - running in parallel; each operation will generally be allowed > + Note that a complex query may include several sort or hash > + operations; each such operation will generally be 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. > > I also find this wording a bit further down to be poor: > > 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 > work_mem by > hash_mem_multiplier. This makes it > > I think "available" is not le mot juste, and it's also unclear from > this whether we're speaking of the per-hash-table limit or some > (nonexistent) overall limit. How about > > - memory available for hash tables is computed by multiplying > + memory limit for a hash table is computed by multiplying Adjusted patch attached. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. --KqmZzgI8Kh67ECZR 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..45d1bb4b7b 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 or 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 --KqmZzgI8Kh67ECZR--