4 ms·
Create Statistics in PostgreSQL 10
- fabian2k 9y agoThe biggest issue related to statistics I've encountered is when using jsonb columns. As far as I understand they have a hardcoded statistic, which can cause pretty bad plans if your data isn't close to that value. You can create an index on individual keys in the jsonb column, which do have their own statistic, but that is not really an option for most cases where you'd use jsonb in the first place. Bad statistics can really mess up queries, so any tool to fix this kind of situation is very welcome. I don't think this specific tool would help with this variant of bad statistics, unfortunately.
- joevandyk 9y agohttps://blog.anayrat.info/en/2017/11/26/postgresql---jsonb-and-statistics/ https://blog.anayrat.info/en/2017/11/26/postgresql---jsonb-a... explains this problem in more detail.
- comboy 9y agoWill that slow down inserts? Or am I understanding it wrong and this is just one time generation like vacuum analyze?
- gaius 9y agoThe latter. What would slow down inserts is excessive indexing
- comboy 9y agoYeah, been there. Kinda too bad that it's just a one time thing. But even if it wouldn't be, I forgot that unlike index update it doesn't have to block transaction, it can be updated whenever later and doesn't have to be done after each insert. Anyway, postgres team is doing awesome things. So much great functionality while keeping it rock stable. Kudos.
- gaius 9y agoI assume once you’ve told it once it will maintain them when it autovacuums. But the correlations shouldn’t change that much if the source data is genuinely connected
- Tostino 9y agoVery cool feature which will help certain use cases which have no other way of improving the plan chosen without changing the way the data is stored.