-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: add optimizer_use_limit_ordering_for_streaming_group_by session setting #94672
sql: add optimizer_use_limit_ordering_for_streaming_group_by session setting #94672
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 11 of 11 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @rharding6373)
@@ -228,6 +228,10 @@ func (c *CustomFuncs) GenerateStreamingGroupByLimitOrderingHint( | |||
groupingCols opt.ColSet, | |||
newOrdering props.OrderingChoice, | |||
) { | |||
if !c.e.evalCtx.SessionData().OptimizerUseLimitOrderingForStreamingGroupBy { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add an xform test with this setting disabled and an expect-not
to verify this works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 2 of 0 LGTMs obtained (waiting on @msirek)
…setting Fixes cockroachdb#93410 This commit adds the `optimizer_use_limit_ordering_for_streaming_group_by` session setting that defaults to `true`. When `true`, an exploration rule which uses the ordering specified in a `SELECT ... GROUP BY ... ORDER BY ... LIMIT n;` statement as an interesting ordering to require from the input to the group-by expression, possibly eliminating a top-k operation. When `false`, the exploration rule is disabled. Release note: None
905b302
to
63d9aed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTRs!
bors r+
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 2 stale) (waiting on @DrewKimball and @mgartner)
pkg/sql/opt/xform/groupby_funcs.go
line 231 at r1 (raw file):
Previously, mgartner (Marcus Gartner) wrote…
nit: add an xform test with this setting disabled and an
expect-not
to verify this works
Done
Build succeeded: |
Fixes #93410
This commit adds the
optimizer_use_limit_ordering_for_streaming_group_by
session setting that defaults totrue
. Whentrue
, an exploration rule which uses the ordering specified in aSELECT ... GROUP BY ... ORDER BY ... LIMIT n;
statement as an interesting ordering to require from the input to the group-by expression, possibly eliminating a top-k operation. Whenfalse
, the exploration rule is disabled.Release note: None