Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)
Date: 2018-07-11 12:46:44
Message-ID: CAJrrPGfd1moDHR_D9ck_bxmKqinT1g3V9UhOX4rnmS-hB00QSA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 30, 2018 at 1:38 PM Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
wrote:

> On Mon, Apr 30, 2018 at 3:13 PM, Andres Freund <andres(at)anarazel(dot)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.
>

I checked the patch and I agree with the change 1). And regarding change 2)
whether it is zeroing the contents of the page or not, it does read?
because if it exists in the buffer pool, we are counting them as hits
irrespective
of the mode? Am I missing something?

Regards,
Haribabu Kommi
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2018-07-11 13:00:47 Re: Negotiating the SCRAM channel binding type
Previous Message Dilip Kumar 2018-07-11 12:39:58 Re: partition pruning doesn't work with IS NULL clause in multikey range partition case