PlannerAny session (SET)default 100
default_statistics_target
Sets the default statistics target.
How you change it
Any session (SET)
Defaults and ranges on this page were read from pg_settings on live PostgreSQL 18.4. Treat older majors as needing their own check before you copy a value.
This applies to table columns that have not had a column-specific target set via ALTER TABLE SET STATISTICS.
What this means
Controls how much detail ANALYZE collects for each column: the number of entries in the most-common-values list and histogram, and the sample size. Higher targets give the planner sharper selectivity estimates at the cost of slower ANALYZE and slightly larger statistics.
When it matters
Raise per-column with ALTER TABLE ... SET STATISTICS on skewed or heavily-filtered columns rather than globally.
| Default | 100 |
|---|---|
| Range | 1 – 10000 |
| Type | integer |
| Change scope | Any session (SET) |
| Category | Planner |
Check the current value
SHOW default_statistics_target;Tradeoffs
- • Too low: poor row estimates on skewed data lead to bad plans.
- • Too high globally: ANALYZE runs longer and planning uses more memory for every table.
- • Targeted per-column increases beat a large global default.