default_statistics_target
Read PG 18 manual ↗Sets the default statistics target for table columns without a column-specific target set via ALTER TABLE SET STATISTICS.
- Type
- integer
- Context
- user
- Measured default
- 100
- Unit
- —
- Metadata snapshot
- 18
Definition PG 18 manual
Sets the default statistics target for table columns without a column-specific target set via ALTER TABLE SET STATISTICS. Larger values increase the time needed to do ANALYZE, but might improve the quality of the planner's estimates. The default is 100. For more information on the use of statistics by the PostgreSQL query planner, refer to Section 14.2.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 19 | 100 |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
The target limits the number of entries in most-common-value lists and histogram bins stored for a column. The planner uses those statistics to estimate row counts, which feed access-path, join-order, and join-method decisions.
ANALYZE samples large tables rather than reading every row. Its sample size is driven by the largest statistics target among the columns being analyzed, so increasing the target raises analysis time and space roughly in proportion.
ALTER TABLE ... ALTER COLUMN ... SET STATISTICS overrides the global default for a column. Correlation between columns is a separate problem that normally requires CREATE STATISTICS rather than simply increasing this setting.
Operational considerations
Changing the setting does not refresh existing statistics; ANALYZE must run afterward.
Higher single-column targets do not model cross-column correlation by themselves.
A high global target increases ANALYZE work even for unimportant columns.
Partitioned parents can require manual ANALYZE because child changes do not trigger it.
Approximate sampling can still produce estimation error and plan variation.
Workload guidance
OLAP: A higher baseline can help complex filters and joins, but use extended statistics for correlated predicates and budget the extra ANALYZE time after bulk loads.
OLTP: Keep the global target moderate and raise it for skewed columns that actually produce row-estimate errors. Re-run ANALYZE and compare estimated versus actual rows before and after.
SMALL: A modest global increase is usually inexpensive, but per-column tuning remains more precise. Do not collect deep histograms for columns never used in predicates, grouping, or ordering.
Related entries
Further reading
Definition snapshot: english-manuals:f0c73496b1eadba3051c19ba1af… · English manual source