Default sampling detail for ANALYZE statistics.
At a glance
| Property | Value |
|---|---|
| Parameter | default_statistics_target |
| Category | planner">Query Planner |
| Default | 100 |
| Value type | boolean / enum / numeric |
| Change scope | Per-session (SET) |
What it does
Controls how many entries are stored in pg_statistic per column (histogram buckets / most-common-values). Higher means more accurate estimates but slower ANALYZE and larger stats.
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW default_statistics_target; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'default_statistics_target';.
Tuning guidance
Raise per-column with ALTER TABLE ... ALTER COLUMN ... SET STATISTICS for skewed/large columns feeding bad plans, rather than globally. Global 100 suits most workloads.