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

Function cdbexplain_showExecStatsBegin

src/backend/commands/explain_gp.c:1487–1512  ·  view source on GitHub ↗

* cdbexplain_showExecStatsBegin * Called by qDisp process to create a CdbExplain_ShowStatCtx structure * in which to accumulate overall statistics for a query. * * 'querystarttime' is the timestamp of the start of the query, in a * platform-dependent format. * * Note this function is called before ExecutorStart(), so there is no EState * or SliceTable yet. */

Source from the content-addressed store, hash-verified

1485 * or SliceTable yet.
1486 */
1487struct CdbExplain_ShowStatCtx *
1488cdbexplain_showExecStatsBegin(struct QueryDesc *queryDesc,
1489 instr_time querystarttime)
1490{
1491 CdbExplain_ShowStatCtx *ctx;
1492 int nslice;
1493
1494 Assert(Gp_role != GP_ROLE_EXECUTE);
1495
1496 /* Allocate and zero the ShowStatCtx */
1497 ctx = (CdbExplain_ShowStatCtx *) palloc0(sizeof(*ctx));
1498
1499 ctx->querystarttime = querystarttime;
1500
1501 /* Determine number of slices. (SliceTable hasn't been built yet.) */
1502 nslice = queryDesc->plannedstmt->numSlices;
1503
1504 /* Allocate and zero the SliceSummary array. */
1505 ctx->nslice = nslice;
1506 ctx->slices = (CdbExplain_SliceSummary *) palloc0(nslice * sizeof(ctx->slices[0]));
1507
1508 /* Allocate a buffer in which we can collect any extra message text. */
1509 initStringInfoOfSize(&ctx->extratextbuf, 4000);
1510
1511 return ctx;
1512} /* cdbexplain_showExecStatsBegin */
1513
1514/*
1515 * cdbexplain_showStatCtxFree

Callers 2

explain_ExecutorStartFunction · 0.85
ExplainOnePlanFunction · 0.85

Calls 2

initStringInfoOfSizeFunction · 0.85
palloc0Function · 0.50

Tested by

no test coverage detected