DBAtlas · Database operations atlas

Increase a column's statistics target

PostgreSQLMaintenance

Command

ALTER TABLE customer ALTER COLUMN city SET STATISTICS 500; ANALYZE customer;

What it does

Increases the histogram/sample detail collected for a specific column; improves the planner's estimates.

When to use it

When bad query plans occur on columns with skewed distributions.

Caution

A high value (default 100, max 10000) increases ANALYZE time and planning time. The change takes effect only after ANALYZE.

Open in DBAtlas →

Related