pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter J. Holzer <hjp-pgsql@hjp.at>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Lots of read activity on index only scan
Date: Fri, 18 Nov 2022 15:59:46 -0500
Message-ID: <2267925.1668805186@sss.pgh.pa.us> (raw)
In-Reply-To: <20221118204617.z5pziyz4n6mllvhe@hjp.at>
References: <20221118204617.z5pziyz4n6mllvhe@hjp.at>

"Peter J. Holzer" <hjp-pgsql@hjp.at> writes:
> Both do a parallel index only scan. Both perform 0 heap fetches.
> But one reads 27336 buffers (or about 22 bytes per index entry, which
> sounds reasonable) while the other reads 9995216 buffers (or almost one
> full buffer per row). Why? The entries should be dense in the index in
> both cases and since it's an index only scan (and explain says there
> were 0 heap fetches) I would not expect extra accesses. Where do these
> buffer reads come from?

An "index only" scan is only that if the table's all-visible map is
fully set.  Did you vacuum this table after building it, or wait
long enough for autovacuum to do so?

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <2267925.1668805186@sss.pgh.pa.us>
Permalink:  ../2267925.1668805186@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2267925.1668805186@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, hjp-pgsql@hjp.at
  Subject: Re: Lots of read activity on index only scan
  In-Reply-To: <2267925.1668805186@sss.pgh.pa.us>
  References: <20221118204617.z5pziyz4n6mllvhe@hjp.at> <2267925.1668805186@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox