Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab72716

Browse files
committed
Support Parallel Append plan nodes.
When we create an Append node, we can spread out the workers over thesubplans instead of piling on to each subplan one at a time, whichshould typically be a bit more efficient, both because the startupcost of any plan executed entirely by one worker is paid only once andalso because of reduced contention. We can also construct Appendplans using a mix of partial and non-partial subplans, which may allowfor parallelism in places that otherwise couldn't support it.Unfortunately, this patch doesn't handle the important case ofparallelizing UNION ALL by running each branch in a separate worker;the executor infrastructure is added here, but more planner work isneeded.Amit Khandekar, Robert Haas, Amul Sul, reviewed and tested byAshutosh Bapat, Amit Langote, Rafia Sabih, Amit Kapila, andRajkumar Raghuwanshi.Discussion:http://postgr.es/m/CAJ3gD9dy0K_E8r727heqXoBmWZ83HwLFwdcaSSmBQ1+S+vRuUQ@mail.gmail.com
1 parent8097d18 commitab72716

File tree

31 files changed

+959
-129
lines changed

31 files changed

+959
-129
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,6 +3633,20 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
36333633
</listitem>
36343634
</varlistentry>
36353635

3636+
<varlistentry id="guc-enable-parallel-append" xreflabel="enable_parallel_append">
3637+
<term><varname>enable_parallel_append</varname> (<type>boolean</type>)
3638+
<indexterm>
3639+
<primary><varname>enable_parallel_append</> configuration parameter</primary>
3640+
</indexterm>
3641+
</term>
3642+
<listitem>
3643+
<para>
3644+
Enables or disables the query planner's use of parallel-aware
3645+
append plan types. The default is <literal>on</>.
3646+
</para>
3647+
</listitem>
3648+
</varlistentry>
3649+
36363650
<varlistentry id="guc-enable-partition-wise-join" xreflabel="enable_partition_wise_join">
36373651
<term><varname>enable_partition_wise_join</varname> (<type>boolean</type>)
36383652
<indexterm>

‎doc/src/sgml/monitoring.sgml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
845845

846846
<tbody>
847847
<row>
848-
<entry morerows="62"><literal>LWLock</literal></entry>
848+
<entry morerows="63"><literal>LWLock</literal></entry>
849849
<entry><literal>ShmemIndexLock</literal></entry>
850850
<entry>Waiting to find or allocate space in shared memory.</entry>
851851
</row>
@@ -1116,6 +1116,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
11161116
<entry><literal>tbm</literal></entry>
11171117
<entry>Waiting for TBM shared iterator lock.</entry>
11181118
</row>
1119+
<row>
1120+
<entry><literal>parallel_append</literal></entry>
1121+
<entry>Waiting to choose the next subplan during Parallel Append plan
1122+
execution.</entry>
1123+
</row>
11191124
<row>
11201125
<entry morerows="9"><literal>Lock</literal></entry>
11211126
<entry><literal>relation</literal></entry>

‎src/backend/executor/execParallel.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include"executor/execExpr.h"
2727
#include"executor/execParallel.h"
2828
#include"executor/executor.h"
29+
#include"executor/nodeAppend.h"
2930
#include"executor/nodeBitmapHeapscan.h"
3031
#include"executor/nodeCustom.h"
3132
#include"executor/nodeForeignscan.h"
@@ -250,6 +251,11 @@ ExecParallelEstimate(PlanState *planstate, ExecParallelEstimateContext *e)
250251
ExecForeignScanEstimate((ForeignScanState*)planstate,
251252
e->pcxt);
252253
break;
254+
caseT_AppendState:
255+
if (planstate->plan->parallel_aware)
256+
ExecAppendEstimate((AppendState*)planstate,
257+
e->pcxt);
258+
break;
253259
caseT_CustomScanState:
254260
if (planstate->plan->parallel_aware)
255261
ExecCustomScanEstimate((CustomScanState*)planstate,
@@ -453,6 +459,11 @@ ExecParallelInitializeDSM(PlanState *planstate,
453459
ExecForeignScanInitializeDSM((ForeignScanState*)planstate,
454460
d->pcxt);
455461
break;
462+
caseT_AppendState:
463+
if (planstate->plan->parallel_aware)
464+
ExecAppendInitializeDSM((AppendState*)planstate,
465+
d->pcxt);
466+
break;
456467
caseT_CustomScanState:
457468
if (planstate->plan->parallel_aware)
458469
ExecCustomScanInitializeDSM((CustomScanState*)planstate,
@@ -884,6 +895,10 @@ ExecParallelReInitializeDSM(PlanState *planstate,
884895
ExecForeignScanReInitializeDSM((ForeignScanState*)planstate,
885896
pcxt);
886897
break;
898+
caseT_AppendState:
899+
if (planstate->plan->parallel_aware)
900+
ExecAppendReInitializeDSM((AppendState*)planstate,pcxt);
901+
break;
887902
caseT_CustomScanState:
888903
if (planstate->plan->parallel_aware)
889904
ExecCustomScanReInitializeDSM((CustomScanState*)planstate,
@@ -1194,6 +1209,10 @@ ExecParallelInitializeWorker(PlanState *planstate, ParallelWorkerContext *pwcxt)
11941209
ExecForeignScanInitializeWorker((ForeignScanState*)planstate,
11951210
pwcxt);
11961211
break;
1212+
caseT_AppendState:
1213+
if (planstate->plan->parallel_aware)
1214+
ExecAppendInitializeWorker((AppendState*)planstate,pwcxt);
1215+
break;
11971216
caseT_CustomScanState:
11981217
if (planstate->plan->parallel_aware)
11991218
ExecCustomScanInitializeWorker((CustomScanState*)planstate,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp