> PG's optimizer is designed to be very fast not very thorough
Some parameters weight on this policy: geqo_threshold, geqo_effort, constraint_exclusion, from_collapse_limit, join_collapse_limit, jit_above_cost, enable_partition*...
As requiring heavy query optimization usually slows simple queries down, this is a matter of context.