MCPcopy Create free account
hub / github.com/apache/cloudberry / ExecParallelEstimate

Function ExecParallelEstimate

src/backend/executor/execParallel.c:232–308  ·  view source on GitHub ↗

* Parallel-aware plan nodes (and occasionally others) may need some state * which is shared across all parallel workers. Before we size the DSM, give * them a chance to call shm_toc_estimate_chunk or shm_toc_estimate_keys on * &pcxt->estimator. * * While we're at it, count the number of PlanState nodes in the tree, so * we know how many Instrumentation structures we need. */

Source from the content-addressed store, hash-verified

230 * we know how many Instrumentation structures we need.
231 */
232static bool
233ExecParallelEstimate(PlanState *planstate, ExecParallelEstimateContext *e)
234{
235 if (planstate == NULL)
236 return false;
237
238 /* Count this node. */
239 e->nnodes++;
240
241 switch (nodeTag(planstate))
242 {
243 case T_SeqScanState:
244 if (planstate->plan->parallel_aware)
245 ExecSeqScanEstimate((SeqScanState *) planstate,
246 e->pcxt);
247 break;
248 case T_IndexScanState:
249 if (planstate->plan->parallel_aware)
250 ExecIndexScanEstimate((IndexScanState *) planstate,
251 e->pcxt);
252 break;
253 case T_IndexOnlyScanState:
254 if (planstate->plan->parallel_aware)
255 ExecIndexOnlyScanEstimate((IndexOnlyScanState *) planstate,
256 e->pcxt);
257 break;
258 case T_ForeignScanState:
259 if (planstate->plan->parallel_aware)
260 ExecForeignScanEstimate((ForeignScanState *) planstate,
261 e->pcxt);
262 break;
263 case T_AppendState:
264 if (planstate->plan->parallel_aware)
265 ExecAppendEstimate((AppendState *) planstate,
266 e->pcxt);
267 break;
268 case T_CustomScanState:
269 if (planstate->plan->parallel_aware)
270 ExecCustomScanEstimate((CustomScanState *) planstate,
271 e->pcxt);
272 break;
273 case T_BitmapHeapScanState:
274 if (planstate->plan->parallel_aware)
275 ExecBitmapHeapEstimate((BitmapHeapScanState *) planstate,
276 e->pcxt);
277 break;
278 case T_HashJoinState:
279 if (planstate->plan->parallel_aware)
280 ExecHashJoinEstimate((HashJoinState *) planstate,
281 e->pcxt);
282 break;
283 case T_HashState:
284 /* even when not parallel-aware, for EXPLAIN ANALYZE */
285 ExecHashEstimate((HashState *) planstate, e->pcxt);
286 break;
287 case T_SortState:
288 /* even when not parallel-aware, for EXPLAIN ANALYZE */
289 ExecSortEstimate((SortState *) planstate, e->pcxt);

Callers 1

ExecInitParallelPlanFunction · 0.85

Calls 14

ExecSeqScanEstimateFunction · 0.85
ExecIndexScanEstimateFunction · 0.85
ExecForeignScanEstimateFunction · 0.85
ExecAppendEstimateFunction · 0.85
ExecCustomScanEstimateFunction · 0.85
ExecBitmapHeapEstimateFunction · 0.85
ExecHashJoinEstimateFunction · 0.85
ExecHashEstimateFunction · 0.85
ExecSortEstimateFunction · 0.85
ExecAggEstimateFunction · 0.85

Tested by

no test coverage detected