Re: Less selective index chosen unexpectedly

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: James Coleman <jtc331(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Less selective index chosen unexpectedly
Date: 2021-05-18 21:50:48
Message-ID: 20210518215048.GA22962@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2021-May-18, Tom Lane wrote:

> The only thing I see that's really going wrong here is marginally
> inaccurate stats, especially right after a big insertion that's
> not reflected into the stats yet. I'm not sure there's much to
> improve there. You could increase the stats target some more,
> though of course that just pushes out the size of table where
> the issue will appear.

I think the real winner would be a mechanism to incrementally analyze
tables, so that it updates the existing stats by sampling only blocks
that have new data, and "somehow" merge that into the existing
statistics. You could have such a process run much more frequently than
standard analyze, because the cost is [supposed to be] smaller.

Of course, the big problem with this idea is how would you merge/update
the stats at all in the first place.

... ah, it appears there have been attempts at this already:
https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.63.5414&rep=rep1&type=pdf

--
Álvaro Herrera Valdivia, Chile
"Ed is the standard text editor."
http://groups.google.com/group/alt.religion.emacs/msg/8d94ddab6a9b0ad3

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2021-05-18 22:16:16 BUG #17020: meta command psql \reset does not clear the query buffer
Previous Message Tom Lane 2021-05-18 21:34:20 Re: Less selective index chosen unexpectedly