diff options
| author | Jeff Davis | 2020-04-08 03:42:04 +0000 |
|---|---|---|
| committer | Jeff Davis | 2020-04-08 04:25:28 +0000 |
| commit | 50a38f65177ea7858bc97f71ba0757ba04c1c167 (patch) | |
| tree | 4268856dc26ff94aa955bef1a80577e884f09206 /src/include/executor | |
| parent | f0705bb6286d8a24e08ddd99641264ba947ebd03 (diff) | |
Create memory context for HashAgg with a reasonable maxBlockSize.
If the memory context's maxBlockSize is too big, a single block
allocation can suddenly exceed work_mem. For Hash Aggregation, this
can mean spilling to disk too early or reporting a confusing memory
usage number for EXPLAN ANALYZE.
Introduce CreateWorkExprContext(), which is like CreateExprContext(),
except that it creates the AllocSet with a maxBlockSize that is
reasonable in proportion to work_mem.
Right now, CreateWorkExprContext() is only used by Hash Aggregation,
but it may be generally useful in the future.
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/include/executor')
| -rw-r--r-- | src/include/executor/executor.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 94890512dc8..c7deeac662f 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -493,6 +493,7 @@ extern void end_tup_output(TupOutputState *tstate); extern EState *CreateExecutorState(void); extern void FreeExecutorState(EState *estate); extern ExprContext *CreateExprContext(EState *estate); +extern ExprContext *CreateWorkExprContext(EState *estate); extern ExprContext *CreateStandaloneExprContext(void); extern void FreeExprContext(ExprContext *econtext, bool isCommit); extern void ReScanExprContext(ExprContext *econtext); |
