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

Commitbc7fcab

Browse files
committed
Read from the same worker repeatedly until it returns no tuple.
The original coding read tuples from workers in round-robin fashion,but performance testing shows that it works much better to read enoughto empty one queue before moving on to the next. I believe thereason for this is that, with the old approach, we could easily wakeup a worker repeatedly to write only one new tuple into the shm_mqeach time. With this approach, by the time the process gets scheduled,it has a decent chance of being able to fill the entire buffer inone go.Patch by me. Dilip Kumar helped with performance testing.
1 parent51d152f commitbc7fcab

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎src/backend/executor/nodeGather.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,20 @@ gather_readnext(GatherState *gatherstate)
359359
continue;
360360
}
361361

362-
/* Advance nextreader pointer in round-robin fashion. */
363-
gatherstate->nextreader=
364-
(gatherstate->nextreader+1) %gatherstate->nreaders;
365-
366362
/* If we got a tuple, return it. */
367363
if (tup)
368364
returntup;
369365

366+
/*
367+
* Advance nextreader pointer in round-robin fashion. Note that we
368+
* only reach this code if we weren't able to get a tuple from the
369+
* current worker. We used to advance the nextreader pointer after
370+
* every tuple, but it turns out to be much more efficient to keep
371+
* reading from the same queue until that would require blocking.
372+
*/
373+
gatherstate->nextreader=
374+
(gatherstate->nextreader+1) %gatherstate->nreaders;
375+
370376
/* Have we visited every TupleQueueReader? */
371377
if (gatherstate->nextreader==waitpos)
372378
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp