Skip to content

Commit d1f822e

Browse files
committed
Clarify resource utilization of parallel query.
temp_file_limit is a per-process limit, not a per-session limit across all cooperating parallel processes; change wording accordingly, per a suggestion from Tom Lane. Also, document under max_parallel_workers_per_gather the fact that each process involved in a parallel query may use as many resources as a separate session. Caveat emptor. Per a complaint from Peter Geoghegan.
1 parent 62c8421 commit d1f822e

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

doc/src/sgml/config.sgml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ include_dir 'conf.d'
16031603
</term>
16041604
<listitem>
16051605
<para>
1606-
Specifies the maximum amount of disk space that a session can use
1606+
Specifies the maximum amount of disk space that a process can use
16071607
for temporary files, such as sort and hash temporary files, or the
16081608
storage file for a held cursor. A transaction attempting to exceed
16091609
this limit will be canceled.
@@ -1613,7 +1613,7 @@ include_dir 'conf.d'
16131613
</para>
16141614
<para>
16151615
This setting constrains the total space used at any instant by all
1616-
temporary files used by a given <productname>PostgreSQL</> session.
1616+
temporary files used by a given <productname>PostgreSQL</> process.
16171617
It should be noted that disk space used for explicit temporary
16181618
tables, as opposed to temporary files used behind-the-scenes in query
16191619
execution, does <emphasis>not</emphasis> count against this limit.
@@ -2011,6 +2011,22 @@ include_dir 'conf.d'
20112011
be inefficient. The default value is 2. Setting this value to 0
20122012
disables parallel query execution.
20132013
</para>
2014+
2015+
<para>
2016+
Note that parallel queries may consume very substantially more
2017+
resources than non-parallel queries, because each worker process is
2018+
a completely separate process which has roughly the same impact on the
2019+
system as an additional user session. This should be taken into
2020+
account when choosing a value for this setting, as well as when
2021+
configuring other settings that control resource utilization, such
2022+
as <xref linkend="guc-work-mem">. Resource limits such as
2023+
<varname>work_mem</> are applied individually to each worker,
2024+
which means the total utilization may be much higher across all
2025+
processes than it would normally be for any single process.
2026+
For example, a parallel query using 4 workers may use up to 5 times
2027+
as much CPU time, memory, I/O bandwidth, and so forth as a query which
2028+
uses no workers at all.
2029+
</para>
20142030
</listitem>
20152031
</varlistentry>
20162032

src/backend/utils/misc/guc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,7 @@ static struct config_int ConfigureNamesInt[] =
19471947

19481948
{
19491949
{"temp_file_limit", PGC_SUSET, RESOURCES_DISK,
1950-
gettext_noop("Limits the total size of all temporary files used by each session."),
1950+
gettext_noop("Limits the total size of all temporary files used by each process."),
19511951
gettext_noop("-1 means no limit."),
19521952
GUC_UNIT_KB
19531953
},

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138

139139
# - Disk -
140140

141-
#temp_file_limit = -1 # limits per-session temp file space
141+
#temp_file_limit = -1 # limits per-process temp file space
142142
# in kB, or -1 for no limit
143143

144144
# - Kernel Resource Usage -

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy