DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Query Tuning / Genetic Query Optimizer

geqo_selection_bias

GEQO: selective pressure within the population.

  • Default: 2
  • Type: real
  • Range: 1.5 … 2
  • Applies: Session (any user)

In plain words

When the genetic optimizer picks two "parents" to breed, it favours the cheaper join orders. This controls how strong that preference is. 2.0 picks the best ones most often; 1.5 gives weaker candidates more chances, keeping more variety.

For DBAs and operators

Parents are drawn from the population sorted by cost using a linear bias function: index = pool × (bias − √(bias² − 4(bias−1)·r)) / (2(bias−1)) with a random r in [0,1). At 2.0 the best member is chosen about twice as often as the average one; at 1.5 the distribution is flatter.

High pressure converges quickly but can get stuck on a mediocre order; lower pressure explores more but needs more generations. In practice this is almost never changed; it exists for experimentation. In the animation, watch which squares pulse as parents: with 2.0 they cluster on the green (cheap) left side.

How to change it

Any user can change it for their session with SET.

See it in context

Planner cost model

Related parameters

geqo_pool_size geqo_generations geqo_effort

All Query Tuning parameters