pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Michael Lewis <mlewis@entrata.com>
Cc: Israel Brewster <ijbrewster@alaska.edu>
Cc: PostgreSQL Mailing Lists <pgsql-general@postgresql.org>
Subject: Re: Faster distinct query?
Date: Wed, 22 Sep 2021 16:48:42 -0400
Message-ID: <2228441.1632343722@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwYWY-2ohhQ_K0Lcr1V1_aT5=Qvk8oeScmMWm54rZKynUg@mail.gmail.com>
References: <0BB059BF-54BD-46FA-8B26-28FEF9A04198@alaska.edu>
	<CAHOFxGrvxWFTxNQZNe-cWgf__5ErEZ5JUoFzHNXGGnK9=oqX-A@mail.gmail.com>
	<CAKFQuwYWY-2ohhQ_K0Lcr1V1_aT5=Qvk8oeScmMWm54rZKynUg@mail.gmail.com>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> There is no where clause so I'm doubtful there is much to be gained going
> down this path.  The Index-Only scan seems like an optimal way to obtain
> this data and the existing query already does that.

The "index-only" scan is reported to do 86m heap fetches along the
way to returning 812m rows, so the data is apparently pretty dirty.
It's possible that a preliminary VACUUM to get page-all-visible hint
bits set would be a net win.

			regards, tom lane





view thread (34+ messages)  latest in thread

Message-ID: <2228441.1632343722@sss.pgh.pa.us>
Permalink:  ../2228441.1632343722@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2228441.1632343722@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, david.g.johnston@gmail.com, mlewis@entrata.com, ijbrewster@alaska.edu
  Subject: Re: Faster distinct query?
  In-Reply-To: <2228441.1632343722@sss.pgh.pa.us>
  References: <0BB059BF-54BD-46FA-8B26-28FEF9A04198@alaska.edu> <CAHOFxGrvxWFTxNQZNe-cWgf__5ErEZ5JUoFzHNXGGnK9=oqX-A@mail.gmail.com> <CAKFQuwYWY-2ohhQ_K0Lcr1V1_aT5=Qvk8oeScmMWm54rZKynUg@mail.gmail.com> <2228441.1632343722@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