Re: Lots of read activity on index only scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Lots of read activity on index only scan
Date: 2022-11-18 20:59:46
Message-ID: 2267925.1668805186@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"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. Did you vacuum this table after building it, or wait
long enough for autovacuum to do so?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2022-11-18 21:04:49 Re: RES: RES: session_user different from current_user after normal login
Previous Message Murillo corvino rocha 2022-11-18 20:52:29 RES: RES: session_user different from current_user after normal login