Accounting of zero-filled buffers in EXPLAIN (BUFFERS)

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)
Date: 2018-04-30 02:59:31
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers


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

Attachment Content-Type Size
0001-Don-t-count-zero-filled-buffers-as-read-in-EXPLAIN.patch application/octet-stream 1.5 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-04-30 03:13:18 Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)
Previous Message Craig Ringer 2018-04-30 02:46:00 Re: Postgres, fsync, and OSs (specifically linux)