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
Message-ID: CAEepm=3JytB3KPpvSwXzkY+dwc5zC8P8Lk7Nedkoci81_0E9rA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
0001-Don-t-count-zero-filled-buffers-as-read-in-EXPLAIN.patch application/octet-stream 1.5 KB

Responses

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)