// postgresql · vacuum, statistics & maintenance

default_statistics_target

How detailed the statistics ANALYZE collects per column.

デフォルト
100
Range
1 to 10000
Restart needed
いいえ
Default checked on
PostgreSQL 18

何ができるか

Controls the number of most-common values and histogram buckets per column (and the sample size: 300 x target rows). Override per column with ALTER TABLE ... ALTER COLUMN ... SET STATISTICS.

デフォルト値

100. 100 (PostgreSQL 18).

Check the current value

SHOW default_statistics_target;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'default_statistics_target';

Change it

SET default_statistics_target = 500;   -- this session
ALTER ROLE reporting SET default_statistics_target = 500;   -- new sessions of one role

ALTER SYSTEM SET default_statistics_target = 500;
SELECT pg_reload_conf();

No restart. Any role can SET it for a session or with SET LOCAL for one transaction; a server-wide ALTER SYSTEM change applies after a reload (context is user).

When to change it

When row estimates in EXPLAIN ANALYZE are far off for skewed columns. Prefer raising it on the specific columns.

What can go wrong

Higher values make ANALYZE slower and planning slightly slower.

Questions about default_statistics_target

What is the default value of default_statistics_target in PostgreSQL?

100. 100 (PostgreSQL 18).

Does changing default_statistics_target require a restart?

No. No restart. Any role can SET it for a session or with SET LOCAL for one transaction; a server-wide ALTER SYSTEM change applies after a reload (context is user).

When should I change default_statistics_target?

When row estimates in EXPLAIN ANALYZE are far off for skewed columns. Prefer raising it on the specific columns.

Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.

// one client for every engine

Check default_statistics_target on your own server

SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.