Statistics targets
It should be obvious from the previous section that the number of buckets used to hold common values or histogram samples significantly influences how accurate query row estimates will be. The number of them ANALYZE
aims to collect is called its target. The postgresql.conf
parameter default_statistics_target
sets the standard target for tables in each database. The default target was 10 up to PostgreSQL 8.3, increasing to 100 in 8.4. This means that 8.4 version has significantly more statistics to work with by default, which normally results in better queries. The cost for that is slightly worse, query planning time as well as significantly longer ANALYZE
processing (that second part not being something most people care very much about).
If you only have simple queries to plan and query planning time is large in a later PostgreSQL version where the target starts at 100, it's possible to reduce default_statistics_target
back to the older starting value of 10...