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 7:50 PM EDT, Peter Geoghegan wrote: > pg@regression:5432 [2476413]=# EXPLAIN (ANALYZE ,costs off, timing off) SELECT * FROM t WHERE a BETWEEN 16336 AND 49103 ORDER BY a desc; > ┌─────────────────────────────────────────────────────────────────────┐ > │ QUERY PLAN │ > ├─────────────────────────────────────────────────────────────────────┤ > │ Index Scan Backward using idx on t (actual rows=1048576.00 loops=1) │ > │ Index Cond: ((a >= 16336) AND (a <= 49103)) │ > │ Index Searches: 1 │ > │ Buffers: shared hit=6082 read=77813 │ > │ I/O Timings: shared read=324.305 │ > │ Planning Time: 0.071 ms │ > │ Execution Time: 616.268 ms │ > └─────────────────────────────────────────────────────────────────────┘ > (7 rows) > Also possibly worth noting: I'm pretty sure that "shared hit=6082" is wrong. > Though now it's wrong in the same way with both variants. Actually, "Buffers:" output _didn't_ have the same problem with the randomized test case variants. With master + buffered I/O, with the FS cache dropped, and with the index relation prewarmed, the same query shows the same "Buffers" details that the patch showed earlier: ┌─────────────────────────────────────────────────────────────────────┐ │ QUERY PLAN │ ├─────────────────────────────────────────────────────────────────────┤ │ Index Scan Backward using idx on t (actual rows=1048576.00 loops=1) │ │ Index Cond: ((a >= 16336) AND (a <= 49103)) │ │ Index Searches: 1 │ │ Buffers: shared hit=6085 read=77813 │ │ I/O Timings: shared read=10572.441 │ │ Planning: │ │ Buffers: shared hit=90 read=23 │ │ I/O Timings: shared read=1.212 │ │ Planning Time: 1.505 ms │ │ Execution Time: 10711.853 ms │ └─────────────────────────────────────────────────────────────────────┘ (10 rows) Though it's not particular relevant to the problem at hand, I'll also point out that with a scan of an index such as this (an index that exhibits "heap clustering without heap correlation"), prefetching is particularly important. Here we see a ~17.3x speedup (relative to master + buffered I/O). Nice! -- Peter Geoghegan