Statistics targets

It should be obvious from the preceding 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 that 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 has significantly more statistics to work with by default, which normally results in better queries. The cost for that is slightly poorer 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 and reanalyze the whole database. This can give about a few percent performance boost to running trivial queries in newer versions.