Do EXTENDED STATISTICS have any trade offs in PostgreSQL?

217 Views Asked by At

Extended Statistics help the planner with evaluating the query complexity in order to choose the correct algorithm for processing the query. Creating new statistics on a couple of dependant columns in a table probably creates some complex structure somewhere in the database because they have to be refreshed by ANALYZ(E)ing the table. There's a table pg_statistics_ext_data which I can't even view because my master (and only) account does not have the rights to SELECT.

What am I asking is, are they any trade offs to these statistics? Do they take up huge amounts of data on the disk? Can I somehow find out how much?

Why are they not used everytime no matter if I create them manually?

1

There are 1 best solutions below

2
Laurenz Albe On

The expense of maintaining and using these statistics grows with the number of columns. Imagine having to track the interdependencies of each pair of columns in a wide table!

The price for extended statistics has to be paid whenever PostgreSQL collects statistics and whenever a query is planned. That's why they should only be employed qhen necessary.