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

Function ExecEndPlan

src/backend/executor/execMain.c:2597–2634  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecEndPlan * * Cleans up the query plan -- closes files and frees up storage * * NOTE: we are no longer very worried about freeing storage per se * in this code; FreeExecutorState should be guaranteed to release all * memory that needs to be released. What we are worried about doing * is closing relations and dropping b

Source from the content-addressed store, hash-verified

2595 * ----------------------------------------------------------------
2596 */
2597void
2598ExecEndPlan(PlanState *planstate, EState *estate)
2599{
2600 ListCell *l;
2601
2602 /*
2603 * shut down the node-type-specific query processing
2604 */
2605 ExecEndNode(planstate);
2606
2607 /*
2608 * for subplans too
2609 */
2610 foreach(l, estate->es_subplanstates)
2611 {
2612 PlanState *subplanstate = (PlanState *) lfirst(l);
2613
2614 ExecEndNode(subplanstate);
2615 }
2616
2617 /*
2618 * destroy the executor's tuple table. Actually we only care about
2619 * releasing buffer pins and tupdesc refcounts; there's no need to pfree
2620 * the TupleTableSlots, since the containing memory context is about to go
2621 * away anyway.
2622 */
2623 ExecResetTupleTable(estate->es_tupleTable, false);
2624
2625 /* Adjust INSERT/UPDATE/DELETE count for replicated table ON QD */
2626 AdjustReplicatedTableCounts(estate);
2627
2628 /*
2629 * Close any Relations that have been opened for range table entries or
2630 * result relations.
2631 */
2632 ExecCloseResultRelations(estate);
2633 ExecCloseRangeTableRelations(estate);
2634}
2635
2636/*
2637 * Close any relations that have been opened for ResultRelInfos.

Callers 1

standard_ExecutorEndFunction · 0.85

Calls 6

ExecEndNodeFunction · 0.85
ExecResetTupleTableFunction · 0.85
ExecCloseResultRelationsFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected