Parameter · Query Tuning / Genetic Query Optimizer
geqo_seed
GEQO: seed for random path selection.
- Default:
0 - Type: real
- Range: 0 … 1
- Applies: Session (any user)
In plain words
The genetic optimizer makes random choices. This number seeds the random generator, so the same query with the same statistics always gets the same plan. Changing it explores a different set of random join orders, and may give a different plan.
For DBAs and operators
The random state is initialized from this value for every GEQO run, so planning is deterministic given the same query, statistics and settings. Plans can still change when statistics change after ANALYZE, because costs change and the evolution takes a different path.
Uses: reproducing a customer's bad GEQO plan (use the same seed and settings), or trying a few seeds to see how much plan quality varies for a large query. If quality varies a lot between seeds, raise geqo_effort, raise geqo_threshold, or simplify the join with collapse limits, rather than picking a "lucky" seed, which will not stay lucky when data changes.
How to change it
Any user can change it for their session with SET.