Commit 5702277c authored by Robert Haas's avatar Robert Haas

Tweak EXPLAIN for parallel query to show workers launched.

The previous display was sort of confusing, because it didn't
distinguish between the number of workers that we planned to launch
and the number that actually got launched.  This has already confused
several people, so display both numbers and label them clearly.

Julien Rouhaud, reviewed by me.
parent 6b85d4ba
...@@ -1339,8 +1339,16 @@ ExplainNode(PlanState *planstate, List *ancestors, ...@@ -1339,8 +1339,16 @@ ExplainNode(PlanState *planstate, List *ancestors,
if (plan->qual) if (plan->qual)
show_instrumentation_count("Rows Removed by Filter", 1, show_instrumentation_count("Rows Removed by Filter", 1,
planstate, es); planstate, es);
ExplainPropertyInteger("Number of Workers", ExplainPropertyInteger("Workers Planned",
gather->num_workers, es); gather->num_workers, es);
if (es->analyze)
{
int nworkers;
nworkers = ((GatherState *) planstate)->nworkers_launched;
ExplainPropertyInteger("Workers Launched",
nworkers, es);
}
if (gather->single_copy) if (gather->single_copy)
ExplainPropertyText("Single Copy", ExplainPropertyText("Single Copy",
gather->single_copy ? "true" : "false", gather->single_copy ? "true" : "false",
......
...@@ -166,6 +166,7 @@ ExecGather(GatherState *node) ...@@ -166,6 +166,7 @@ ExecGather(GatherState *node)
*/ */
pcxt = node->pei->pcxt; pcxt = node->pei->pcxt;
LaunchParallelWorkers(pcxt); LaunchParallelWorkers(pcxt);
node->nworkers_launched = pcxt->nworkers_launched;
/* Set up tuple queue readers to read the results. */ /* Set up tuple queue readers to read the results. */
if (pcxt->nworkers_launched > 0) if (pcxt->nworkers_launched > 0)
......
...@@ -1956,6 +1956,7 @@ typedef struct GatherState ...@@ -1956,6 +1956,7 @@ typedef struct GatherState
struct ParallelExecutorInfo *pei; struct ParallelExecutorInfo *pei;
int nreaders; int nreaders;
int nextreader; int nextreader;
int nworkers_launched;
struct TupleQueueReader **reader; struct TupleQueueReader **reader;
TupleTableSlot *funnel_slot; TupleTableSlot *funnel_slot;
bool need_to_scan_locally; bool need_to_scan_locally;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment