Re: Lots of read activity on index only scan

From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Lots of read activity on index only scan
Date: 2022-11-18 21:38:28
Message-ID: 20221118213828.4gihtcely4pgbdh2@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2022-11-18 15:59:46 -0500, Tom Lane wrote:
> "Peter J. Holzer" <hjp-pgsql(at)hjp(dot)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.

Yes, but shouldn't that be reflected in the heap fetches? Or am I
misunderstanding what that means?

Plus:

> Did you vacuum this table after building it, or wait long enough for
> autovacuum to do so?

Both actually. I built the table this morning and did all the tests
again just before posting. And I explicitely vacuumed it during this
second set of tests. I should have mentioned that, sorry. Also possibly
relevant: This is on Pg 15.1 (PGDG build for Ubuntu).

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2022-11-18 21:50:26 Re: Lots of read activity on index only scan
Previous Message Bryn Llewellyn 2022-11-18 21:11:24 Re: Seeking practice recommendation: is there ever a use case to have two or more superusers?