Planner & statistics

Statistics target

Also called: default_statistics_target, SET STATISTICS

The statistics target is a knob that controls how detailed a column's statistics are, how many most-common values and histogram buckets ANALYZE keeps, and how many rows it samples. The default is 100.

What this means

A dial for how detailed a column's statistics are, how many common values and histogram buckets ANALYZE keeps, and how big a sample it takes. The default is 100. Turn it up on a column the planner keeps misjudging and it gets a finer, more accurate picture, at the cost of a slower ANALYZE.

Why it matters operationally

Raising it (globally with default_statistics_target, or per column with ALTER TABLE ... SET STATISTICS) gives the planner a sharper picture of skewed data, at the cost of slower ANALYZE and slightly slower planning. It is the main lever when a column's estimates are too coarse.

← All glossary terms · GUC reference · Error catalog