Re: Faster distinct query?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Michael Lewis <mlewis(at)entrata(dot)com>, Israel Brewster <ijbrewster(at)alaska(dot)edu>, PostgreSQL Mailing Lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Faster distinct query?
Date: 2021-09-22 20:48:42
Message-ID: 2228441.1632343722@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ryan Booz 2021-09-22 20:49:29 Re: Faster distinct query?
Previous Message Israel Brewster 2021-09-22 20:41:15 Re: Faster distinct query?