Planner & statistics

Correlation (statistics)

Also called: physical correlation, correlation statistic

Correlation measures how closely the physical order of rows on disk matches the sorted order of a column's values, on a scale from -1 to 1. A value near 1 means the table is almost already in that column's order.

What this means

A score from -1 to 1 for how closely a column's values are already laid out in order on disk. Near 1 means the table is basically stored in that column's sorted order, so reading a range is one smooth sweep instead of jumping all over the disk. It's a big input to whether an index scan looks cheap.

Why it matters operationally

It tells the planner whether an index range scan will read disk pages in near-sequential order (fast) or jump around randomly (slow). High correlation makes index scans much cheaper, which is exactly the order that CLUSTER tries to create.

Related & next

ANALYZE Internals, how correlation is computedIndex, what correlation makes cheaper or dearerPage, the unit correlation is really about

← All glossary terms · GUC reference · Error catalog