On Fri, Aug 15, 2025 at 1:23 PM Andres Freund <and...@anarazel.de> wrote: > Somewhat random note about I/O waits: > > Unfortunately the I/O wait time we measure often massively *over* estimate the > actual I/O time. If I execute the above query with the patch applied, we > actually barely ever wait for I/O to complete, it's all completed by the time > we have to wait for the I/O. What we are measuring is the CPU cost of > *initiating* the I/O.
I do get that. This was really obvious when I temporarily switched the prefetch patch over from using READ_STREAM_DEFAULT to using READ_STREAM_USE_BATCHING (this is probably buggy, but still seems likely to be representative of what's possible with some care). I noticed that that change reduced the reported "shared read" time by 10x -- which had exactly zero impact on query execution time (at least for the queries I looked at). Since, as you say, the backend didn't have to wait for I/O to complete either way. -- Peter Geoghegan