Hi,
In EXPLAIN (BUFFERS), there are two kinds of cache misses that show up
as "reads" when in fact they are not reads at all:
1. Relation extension, which in fact writes a zero-filled block.
2. The RBM_ZERO_* modes, which provoke neither read nor write.
Here's a suggested fix.
I noticed this because I have some patches in development that hit
these cases a bit more and the numbers didn't match my expectation. I
suppose someone might want a separate counter for zero-filled buffers
(they're still buffer interactions and cache misses) but it seems like
it's probably below the kind of thing we're interested in counting
(though in passing, I notice recently that some kernels keep some free
pages pre-zeroed so they can supply them faster, which is curious).
--
Thomas Munro
http://www.enterprisedb.com