* 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. */
| 230 | * we know how many Instrumentation structures we need. |
| 231 | */ |
| 232 | static bool |
| 233 | ExecParallelEstimate(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); |
no test coverage detected