pg.ddx.io pgsql-performance@postgresql.org mailing list archivehelp / color / mirror / Atom feed
[PATCH 2/2] allocate BufFile eagerly 1+ messages / 1 participants [nested] [flat]
* [PATCH 2/2] allocate BufFile eagerly @ 2019-04-20 19:59 Tomas Vondra <tomas@2ndquadrant.com> 0 siblings, 0 replies; 1+ messages in thread From: Tomas Vondra @ 2019-04-20 19:59 UTC (permalink / raw) --- src/backend/executor/nodeHash.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index 7d36c22d61..7f125d8dba 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -915,6 +915,7 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable) if (hashtable->innerBatchFile == NULL) { + int i; MemoryContext oldctx; hashtable->fileCtx = AllocSetContextCreate(CurrentMemoryContext, @@ -931,10 +932,20 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable) /* time to establish the temp tablespaces, too */ PrepareTempTablespaces(); + for (i = 1; i < nbatch; i++) + { + if (!hashtable->innerBatchFile[i]) + hashtable->innerBatchFile[i] = BufFileCreateTemp(false); + + if (!hashtable->outerBatchFile[i]) + hashtable->outerBatchFile[i] = BufFileCreateTemp(false); + } + MemoryContextSwitchTo(oldctx); } else { + int i; MemoryContext oldctx; oldctx = MemoryContextSwitchTo(hashtable->fileCtx); @@ -949,6 +960,15 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable) MemSet(hashtable->outerBatchFile + oldnbatch, 0, (nbatch - oldnbatch) * sizeof(BufFile *)); + for (i = 1; i < nbatch; i++) + { + if (!hashtable->innerBatchFile[i]) + hashtable->innerBatchFile[i] = BufFileCreateTemp(false); + + if (!hashtable->outerBatchFile[i]) + hashtable->outerBatchFile[i] = BufFileCreateTemp(false); + } + MemoryContextSwitchTo(oldctx); } -- 2.20.1 --73g6wg24zkedq45b-- ^ permalink raw reply [nested|flat] 1+ messages in thread
only message in thread Thread overview: 1+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-04-20 19:59 [PATCH 2/2] allocate BufFile eagerly Tomas Vondra <tomas@2ndquadrant.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox