Controls the trade-off between planning time and query plan quality in GEQO.
At a glance
| Property | Value |
|---|---|
| Parameter | geqo_effort |
| Category | Query Planning |
| Default | five |
| Value type | integer |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12) |
What it does
Controls the trade-off between planning time and query plan quality in GEQO. This variable must be an integer in the range from 1 to 10. The default value is five. Larger values increase the time spent doing query planning, but also increase the likelihood that an efficient query plan will be chosen.
geqo_effort doesn’t actually do anything directly; it is only used to compute the default values for the other variables that influence GEQO behavior (described below). If you prefer, you can set the other parameters by hand instead.
(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 geqo_effort; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'geqo_effort';.
Tuning guidance
Higher values trade longer planning for better GEQO plans; it only matters once GEQO is active. Most sites leave it at the default 5.