Re: Index Skip Scan - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Index Skip Scan
Date
Msg-id CAH2-Wzkk0+vSAiaRSkX84KR0SofKkY1yGHEcLoRBXT-JjM37bw@mail.gmail.com
Whole thread Raw
In response to Re: Index Skip Scan  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: Index Skip Scan
List pgsql-hackers
On Thu, Aug 16, 2018 at 4:10 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> Can you give an example of problematic ndistinct underestimation?

Yes. See https://postgr.es/m/CAKuK5J12QokFh88tQz-oJMSiBg2QyjM7K7HLnbYi3Ze+Y5BtWQ@mail.gmail.com,
for example. That's a complaint about an underestimation specifically.

This seems to come up about once every 3 years, at least from my
perspective. I'm always surprised that ndistinct doesn't get
implicated in bad query plans more frequently.

> I suppose you might be able to defend against that in the executor: if
> you find that you've done an unexpectedly high number of skips, you
> could fall back to regular next-tuple mode.  Unfortunately that's
> require the parent plan node to tolerate non-unique results.

I like the idea of dynamic fallback in certain situations, but the
details always seem complicated.

-- 
Peter Geoghegan


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] WIP: long transactions on hot standby feedback replica / proof of concept
Next
From: Alexander Korotkov
Date:
Subject: Re: [HACKERS] WIP: long transactions on hot standby feedback replica/ proof of concept