Re:Postgres scaling advice
by jandrewrogers on Tuesday January 26, 2021 @11:58AM
(#25918177)
Yes, everyone knows these things, it does not address the issue. Due to its architecture, there are difficult to change internal limits on how PostgreSQL samples the data.
Under some conditions, it is not possible for the sampling mechanics to build a representative model -- the actual statistics used for query planning will be quasi-random. One of the ways this manifests is that every time you rebuild the statistics you get a completely different statistical model even if the data has barely changed.
You can also create more advanced statistics over multiple columns: https://www.postgresql.org/docs/current/planner-stats.html
But if your statistics are bad, it will certainly mess up some of your query plans.