Re: index prefetching
Peter Geoghegan <pg@bowt.ie>
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
aio: io_uring: Trigger async processing for large IOs
- a9ee66881744 19 (unreleased) landed
-
read stream: Split decision about look ahead for AIO and combining
- 8ca147d582a5 19 (unreleased) landed
-
read_stream: Only increase read-ahead distance when waiting for IO
- f63ca3379025 19 (unreleased) landed
-
read_stream: Prevent distance from decaying too quickly
- 6e36930f9aaf 19 (unreleased) landed
-
Reduce ExecSeqScan* code size using pg_assume()
- b227b0bb4e03 19 (unreleased) cited
-
Fix rare bug in read_stream.c's split IO handling.
- b421223172a2 19 (unreleased) cited
-
Fix multiranges to behave more like dependent types.
- 3e8235ba4f9c 17.0 cited
-
Add EXPLAIN (MEMORY) to report planner memory consumption
- 5de890e3610d 17.0 cited
-
Optimize nbtree backward scan boundary cases.
- c9c0589fda0e 17.0 cited
-
Increment xactCompletionCount during subtransaction abort.
- 90c885cdab8b 14.0 cited
-
Add nbtree Valgrind buffer lock checks.
- 4a70f829d86c 14.0 cited
-
Add nbtree high key "continuescan" optimization.
- 29b64d1de7c7 12.0 cited
-
Reduce pinning and buffer content locking for btree scans.
- 2ed5b87f96d4 9.5.0 cited
-
Teach btree to handle ScalarArrayOpExpr quals natively.
- 9e8da0f75731 9.2.0 cited
On Wed, Aug 13, 2025 at 8:59 PM Tomas Vondra <tomas@vondra.me> wrote: > I investigated this from a different angle, by tracing the I/O request > generated. using perf-trace. And the patterns are massively different. I tried a similar approach myself, using a variety of tools. That didn't get me very far. > So, Q1 ASC gets to combine the I/O into nice large chunks. But the DESC > queries end up doing a stream of 8K requests. The Q2 ASC gets to do 16KB > reads in about half the cases, but the rest is still 8KB. My randomized version of the forwards scan is about as fast (maybe even slightly faster) than your original version on my workstation, in spite of the fact that EXPLAIN ANALYZE reports that the randomized version does indeed have about a 3x higher "I/O Timings: shared read". So I tend to doubt that low-level instrumentation will be all that helpful with debugging the issue. I suppose that it *might* be helpful if you can use it to spot some kind of pattern -- a pattern that hints at the real underlying issue. To me the issue feels like a priority inversion problem. Maybe slow-ish I/O can lead to very very slow query execution time, due to some kind of second order effect (possibly an issue on the read stream side). If that's what this is then the problem still won't be that there was slow-ish I/O, or that we couldn't successfully combine I/Os in whatever way. After all, we surely won't be able to combine I/Os with the randomized version of the queries that I described to the list this evening -- and yet those are still very fast in terms of overall execution time (somehow, they are about as fast as the original variant, that will manage to combine I/Os, in spite of the obvious disadvantage of requiring random I/O for the heap accesses). -- Peter Geoghegan