You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
155163: opt: never pick unbounded generic plans over bounded custom plans r=mgartner a=mgartner
#### opt: make CostFlags an ordered bitmask
`memo.CostFlags` is now an ordered bitmask where each bit indicates a
specific cost penalty and the penalties are ordered by precedence. The
highest precedence penalty uses the highest-order bit. This allows
CostFlags to be easily compared with built-in comparison operators (>,
<, =).
Release note: None
#### opt: rename "CostFlags" to "Penalties"
`memo.CostFlags` has been renamed to `memo.Penalities` which better
reflects its meaning.
Release note: None
#### opt: use a consistent name for the unbounded cardinality penalty
`memo.UnboundedCardinality` has been renamed to
`memo.UnboundedCardinalityPenalty` to be consistent with the names of
the other cost penalties.
Release note: None
#### opt: never pick unbounded generic plans over bounded custom plans
The optimizer will no longer choose a generic query plan with unbounded
cardinality over a custom query plan with bounded cardinality,
regardless of `optimizer_prefer_bounded_cardinality`.
In order to implement this behavior, a flag had to be added to
`memo.Cost` that is separate from `UnboundedCardinalityPenalty`. The
penalty is only added to the cost when
`optimizer_prefer_bounded_cardinality` is enabled. The new flag is
unconditionally set, allowing the decision between a generic and custom
plan to work as expected regardless of the session setting. This is a
tad confusing, so I did my best to document the differences clearly.
Fixes#155159
Release note (performance improvement): The optimizer chooses suboptimal
generic query plans in fewer cases.
#### opt: add cost penalties and aux flags to log line
All cost penalties and auxiliary flags are now printed in the tracing
log for custom and generic query plan costs. This will aid in debugging.
Release note: None
Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
0 commit comments