Accounting of zero-filled buffers in EXPLAIN (BUFFERS) - Mailing list pgsql-hackers

From Thomas Munro
Subject Accounting of zero-filled buffers in EXPLAIN (BUFFERS)
Date
Msg-id CAEepm=3JytB3KPpvSwXzkY+dwc5zC8P8Lk7Nedkoci81_0E9rA@mail.gmail.com
Whole thread Raw
Responses Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Postgres, fsync, and OSs (specifically linux)
Next
From: Andres Freund
Date:
Subject: Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)