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

From Thomas Munro
Subject Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)
Date
Msg-id CAEepm=1FUM0qgHP823wsF50dneX_OOPCkN9fGz5xpBK+MtB1aw@mail.gmail.com
Whole thread Raw
In response to Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)  (Andres Freund <andres@anarazel.de>)
Responses Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)  (Haribabu Kommi <kommi.haribabu@gmail.com>)
List pgsql-hackers
On Mon, Apr 30, 2018 at 3:13 PM, Andres Freund <andres@anarazel.de> wrote:
> On 2018-04-30 14:59:31 +1200, Thomas Munro wrote:
>> 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.
>
> Just for understanding: 2) can never happen for buffers showing up in
> EXPLAIN, right?
>
> I'm not saying you shouldn't fix the accounting...

Maybe the hash AM can reach that in _hash_getinitbuf() while adding
overflow pages to bucket chains?  Admittedly case 2 is obscure and
rare if not unreachable and probably no one would care too much about
that in practice (whereas case 1 can be seen by simply inserting stuff
into a new empty table).  Other patches I'm working on for later
proposal do it more often (think accessing known-empty pages in a kind
of preallocated extent), and it occurred to me that it's clearly a bug
on principle, hence this patch.

-- 
Thomas Munro
http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)
Next
From: Tom Lane
Date:
Subject: Intermittent ECPG test failures on Windows buildfarm machines