I tried 500, to no avail. Since each change involves a delay as RDS
readjusts, I'm going down a different path at the moment.
On 2021-05-29 03:40, Lionel Bouton wrote:
Le 29/05/2021 à 02:38, Dean Gibson (DB Administrator) a écrit :
The original VACUUM FULL ANALYZE ran in 10 hours. The plain ANALYZE
ran in 88 seconds.
One possibility is that your data has a distribution that defeats the
ANALYZE sampling strategy.
If that is the case you can force ANALYZE to do a better job by
increasing the default_statistics_target value (100 by default) and
reload the configuration. This will sample more data from your table
which should help the planner find out what the value distribution
looks like for a column and why using an index for conditions
involving it is a better solution.
The last time I had to use this setting to solve this kind of problem
I ended with :
default_statistics_target = 500
But obviously the value suited to your case could be different (I'd
increase it until the planner uses the correct index). Note that
increasing it increases the costs of maintaining statistics (so you
don't want to increase this by several orders of magnitude blindly)
but the default value seems fairly conservative to me.
For reference and more fine-tuned settings using per table statistics
configuration and multi-column statistics for complex situations, see :
- https://www.postgresql.org/docs/13/runtime-config-query.html
- https://www.postgresql.org/docs/13/planner-stats.html
--
Lionel Bouton
gérant de JTEK SARL
https://www.linkedin.com/in/lionelbouton/