Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3bd35d4

Browse files
committed
HashAgg: release write buffers sooner by rewinding tape.
This was an oversight. The purpose of7fdd919 was to avoid keepingtape buffers around unnecessisarily, but HashAgg didn't rewind earlyenough.Reviewed-by: Peter GeogheganDiscussion:https://postgr.es/m/1fb1151c2cddf8747d14e0532da283c3f97e2685.camel@j-davis.comBackpatch-through: 13
1 parent69bd606 commit3bd35d4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎src/backend/executor/nodeAgg.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2639,8 +2639,6 @@ agg_refill_hash_table(AggState *aggstate)
26392639
*/
26402640
hashagg_recompile_expressions(aggstate, true, true);
26412641

2642-
LogicalTapeRewindForRead(tapeinfo->tapeset,batch->input_tapenum,
2643-
HASHAGG_READ_BUFFER_SIZE);
26442642
for (;;)
26452643
{
26462644
TupleTableSlot*spillslot=aggstate->hash_spill_rslot;
@@ -2923,6 +2921,7 @@ hashagg_tapeinfo_assign(HashTapeInfo *tapeinfo, int *partitions,
29232921
staticvoid
29242922
hashagg_tapeinfo_release(HashTapeInfo*tapeinfo,inttapenum)
29252923
{
2924+
/* rewinding frees the buffer while not in use */
29262925
LogicalTapeRewindForWrite(tapeinfo->tapeset,tapenum);
29272926
if (tapeinfo->freetapes_alloc==tapeinfo->nfreetapes)
29282927
{
@@ -3152,6 +3151,7 @@ hashagg_spill_finish(AggState *aggstate, HashAggSpill *spill, int setno)
31523151

31533152
for (i=0;i<spill->npartitions;i++)
31543153
{
3154+
LogicalTapeSet*tapeset=aggstate->hash_tapeinfo->tapeset;
31553155
inttapenum=spill->partitions[i];
31563156
HashAggBatch*new_batch;
31573157
doublecardinality;
@@ -3163,9 +3163,13 @@ hashagg_spill_finish(AggState *aggstate, HashAggSpill *spill, int setno)
31633163
cardinality=estimateHyperLogLog(&spill->hll_card[i]);
31643164
freeHyperLogLog(&spill->hll_card[i]);
31653165

3166-
new_batch=hashagg_batch_new(aggstate->hash_tapeinfo->tapeset,
3167-
tapenum,setno,spill->ntuples[i],
3168-
cardinality,used_bits);
3166+
/* rewinding frees the buffer while not in use */
3167+
LogicalTapeRewindForRead(tapeset,tapenum,
3168+
HASHAGG_READ_BUFFER_SIZE);
3169+
3170+
new_batch=hashagg_batch_new(tapeset,tapenum,setno,
3171+
spill->ntuples[i],cardinality,
3172+
used_bits);
31693173
aggstate->hash_batches=lcons(new_batch,aggstate->hash_batches);
31703174
aggstate->hash_batches_used++;
31713175
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp