Sets the planner’s estimate of the cost of processing each row during a query.
At a glance
| Property | Value |
|---|---|
| Parameter | cpu_tuple_cost |
| Category | Query Planning |
| Default | 0.01 |
| Value type | floating point |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12) |
What it does
Sets the planner’s estimate of the cost of processing each row during a query. The default is 0.01.
(Description quoted from the official PostgreSQL documentation.)
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 cpu_tuple_cost; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'cpu_tuple_cost';.
Tuning guidance
Raise it (e.g. 0.02-0.04) when the planner under-costs row-heavy scans and keeps picking seq scans over selective indexes; lower it when index plans are chosen too aggressively. Change it per session first and re-check EXPLAIN costs before touching postgresql.conf.