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

Function CreateWorkExprContext

src/backend/executor/execUtils.c:372–388  ·  view source on GitHub ↗

---------------- * CreateWorkExprContext * * Like CreateExprContext, but specifies the AllocSet sizes to be reasonable * in proportion to work_mem. If the maximum block allocation size is too * large, it's easy to skip right past work_mem with a single allocation. * ---------------- */

Source from the content-addressed store, hash-verified

370 * ----------------
371 */
372ExprContext *
373CreateWorkExprContext(EState *estate)
374{
375 Size minContextSize = ALLOCSET_DEFAULT_MINSIZE;
376 Size initBlockSize = ALLOCSET_DEFAULT_INITSIZE;
377 Size maxBlockSize = ALLOCSET_DEFAULT_MAXSIZE;
378
379 /* choose the maxBlockSize to be no larger than 1/16 of work_mem */
380 while (16 * maxBlockSize > work_mem * 1024L)
381 maxBlockSize >>= 1;
382
383 if (maxBlockSize < ALLOCSET_DEFAULT_INITSIZE)
384 maxBlockSize = ALLOCSET_DEFAULT_INITSIZE;
385
386 return CreateExprContextInternal(estate, minContextSize,
387 initBlockSize, maxBlockSize);
388}
389
390/* ----------------
391 * CreateStandaloneExprContext

Callers 1

ExecInitAggFunction · 0.85

Calls 1

Tested by

no test coverage detected