| From: | Yuhang Qiu <iamqyh(at)gmail(dot)com> |
|---|---|
| To: | Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Melanie Plageman <melanieplageman(at)gmail(dot)com> |
| Subject: | Re: [PATCH] Use streaming read I/O in sample scans |
| Date: | 2026-09-07 07:18:19 |
| Message-ID: | 0BF2C976-C5D1-47C7-9AC3-B9D2A1AE6A88@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Nazir,
> Thanks, 0001 and 0002 LGTM.
Thanks for the review. Attached is v3. Compared with v2:
- 0001 now clamps the current look-ahead distances and those saved for
resuming a paused stream when changing to a strategy with a smaller
pin limit.
- In 0003, I moved `stream_flags` into the block that uses it and removed
the temporary `blockno` variable.
- 0002 and 0004 are unchanged.
> I am also not yet convinced that changing the documentation is
> sufficient for `SYSTEM_TIME`. It would be useful to get more opinions
> on whether that change is acceptable or whether `SYSTEM_TIME` should
> avoid to use read streams.
For `SYSTEM_TIME`, I compared the read-stream patch with the unpatched
base using:
```sql
SELECT count(*) FROM wide TABLESAMPLE system_time(100);
```
The table was 1 GiB, with one row per page. I used `shared_buffers=2GB`,
`io_combine_limit=128kB` and `debug_io_direct=data`, evicting the table from
shared buffers before each query. Worker mode used two I/O workers.
Each entry is the median execution time of five `EXPLAIN ANALYZE` runs:
```
io_method effective_io_concurrency Unpatched (ms) Patched (ms)
worker 16 100.14 100.83
worker 256 100.11 103.23
sync 16 100.08 101.51
sync 256 100.11 123.31
io_uring 16 100.10 100.17
io_uring 256 100.10 100.19
```
As you noted, pages selected before the deadline can still be read and
processed afterwards. I'd like to hear what you and others think about
this change to `SYSTEM_TIME`.
Regards,
Yuhang Qiu
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-read_stream-Allow-changing-the-buffer-access-stra.patch | application/octet-stream | 3.6 KB |
| v3-0002-heapam-Keep-read-stream-strategy-in-sync-on-resca.patch | application/octet-stream | 5.7 KB |
| v3-0003-heapam-Use-streaming-read-I-O-in-sample-scans.patch | application/octet-stream | 10.1 KB |
| v3-0004-explain-Report-streaming-I-O-statistics-for-sampl.patch | application/octet-stream | 4.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-09-07 07:22:53 | Re: [PATCH] Remove redundant path_nulls checks in setPathObject/Array |
| Previous Message | Andrey Borodin | 2026-09-07 06:53:24 | Re: Python/pytest test framework take two |