DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Query Tuning / Genetic Query Optimizer

geqo_pool_size

GEQO: number of individuals in the population. 0 means use a suitable default value.

  • Default: 0
  • Type: integer
  • Range: 0 … 2147483647
  • Applies: Session (any user)

In plain words

The genetic optimizer keeps a "population" of possible join orders. This sets its size directly. Zero lets PostgreSQL pick a size based on the number of tables and geqo_effort.

For DBAs and operators

Values of 2 or more set the pool size explicitly; 0 or 1 means automatic: 2^(n+1) clamped to [10 × geqo_effort, 50 × geqo_effort]. The docs suggest values in the range 100 to 1000 if set manually.

The initial population is random, so a bigger pool explores more of the search space before breeding starts. Each member needs a cost estimate (a full join tree is built and costed for it), so the planning cost is roughly proportional to pool size + generations. When generations is automatic, it equals the pool size, which doubles the effect. Prefer geqo_effort unless you have measured a reason to set this.

How to change it

Any user can change it for their session with SET.

See it in context

Planner cost model

Related parameters

geqo_effort geqo_generations geqo_selection_bias

All Query Tuning parameters