Configuration parameter

cpu_operator_cost — PostgreSQL configuration parameter

Category Query Planning Default 0

Sets the planner’s estimate of the cost of processing each operator or function executed during a query.

At a glance

Property Value
Parameter cpu_operator_cost
Category Query Planning
Default 0.0025
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 operator or function executed during a query. The default is 0.0025.

(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_operator_cost; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'cpu_operator_cost';.

Tuning guidance

Increase it when the planner over-favours plans with many quals/expressions evaluated per row (complex filters or hash conditions). Small, coordinated changes to the cpu_* trio move many plans at once, so test on representative queries.

Reference

PostgreSQL documentation — cpu_operator_cost.

Keep going

Related & next steps

Concepts on this page

Was this helpful?

← All configuration parameters