pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix unfairness in all-cached parallel seq scan.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix unfairness in all-cached parallel seq scan.
@ 2024-08-31 05:37  Thomas Munro <tmunro@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Thomas Munro @ 2024-08-31 05:37 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix unfairness in all-cached parallel seq scan.

Commit b5a9b18c introduced block streaming infrastructure with a special
fast path for all-cached scans, and commit b7b0f3f2 connected the
infrastructure up to sequential scans.  One of the fast path
micro-optimizations had an unintended consequence: it interfered with
parallel sequential scan's block range allocator (from commit 56788d21),
which has its own ramp-up and ramp-down algorithm when handing out
groups of pages to workers.  A scan of an all-cached table could give
extra blocks to one worker, when others had finished.  In some plans
(probably already very bad plans, such as the one reported by
Alexander), the unfairness could be magnified.

An internal buffer of 16 block numbers is removed, keeping just a single
block buffer for technical reasons.

Back-patch to 17.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/63a63690-dd92-c809-0b47-af05459e95d1%40gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4effd0844daf41a962c05188b719df75ca8ced93

Modified Files
--------------
src/backend/storage/aio/read_stream.c | 81 ++++++++++-------------------------
1 file changed, 23 insertions(+), 58 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix unfairness in all-cached parallel seq scan.
@ 2024-08-31 05:38  Thomas Munro <tmunro@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Thomas Munro @ 2024-08-31 05:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix unfairness in all-cached parallel seq scan.

Commit b5a9b18c introduced block streaming infrastructure with a special
fast path for all-cached scans, and commit b7b0f3f2 connected the
infrastructure up to sequential scans.  One of the fast path
micro-optimizations had an unintended consequence: it interfered with
parallel sequential scan's block range allocator (from commit 56788d21),
which has its own ramp-up and ramp-down algorithm when handing out
groups of pages to workers.  A scan of an all-cached table could give
extra blocks to one worker, when others had finished.  In some plans
(probably already very bad plans, such as the one reported by
Alexander), the unfairness could be magnified.

An internal buffer of 16 block numbers is removed, keeping just a single
block buffer for technical reasons.

Back-patch to 17.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/63a63690-dd92-c809-0b47-af05459e95d1%40gmail.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3ed3683618cb6a9b10dc5297751fa8b7fe7e36e1

Modified Files
--------------
src/backend/storage/aio/read_stream.c | 81 ++++++++++-------------------------
1 file changed, 23 insertions(+), 58 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-08-31 05:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-08-31 05:37 pgsql: Fix unfairness in all-cached parallel seq scan. Thomas Munro <tmunro@postgresql.org>
2024-08-31 05:38 pgsql: Fix unfairness in all-cached parallel seq scan. Thomas Munro <tmunro@postgresql.org>

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