Type: integer
Default: 8
Min: 1
Max: 2147483647
Context: user
Restart: false

The planner will rewrite explicit JOIN constructs (except FULL JOINs) into lists of FROM items whenever a list of no more than this many items would result. Smaller values reduce planning time but might yield inferior query plans.

By default, this variable is set the same as from_collapse_limit, which is appropriate for most uses. Setting it to 1 prevents any reordering of explicit JOINs. Thus, the explicit join order specified in the query will be the actual order in which the relations are joined. Because the query planner does not always choose the optimal join order, advanced users can elect to temporarily set this variable to 1, and then specify the join order they desire explicitly. For more information see explicit-joins.

Setting this value to geqo_threshold or more may trigger use of the GEQO planner, resulting in non-optimal plans. See runtime-config-query-geqo.

Recommendations

If for some reason you wanted to explicitly declare the join order for all of your queries, you could set this to 1. That is not recommended, though.

Comments