Re: Less selective index chosen unexpectedly - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: Less selective index chosen unexpectedly
Date
Msg-id 20210518215048.GA22962@alvherre.pgsql
Whole thread Raw
In response to Re: Less selective index chosen unexpectedly  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Less selective index chosen unexpectedly  (Peter Geoghegan <pg@bowt.ie>)
List 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



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Less selective index chosen unexpectedly
Next
From: PG Bug reporting form
Date:
Subject: BUG #17020: meta command psql _eset does not clear the query buffer