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
opt: push Offset into IndexJoin #121160
opt: push Offset into IndexJoin #121160
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 2 of 2 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball, @mgartner, and @rytaft)
pkg/sql/opt/xform/testdata/rules/limit
line 896 at r1 (raw file):
└── 5 # Ensure that the limit is not pushed down when using SKIP LOCKED.
Glad you have this case!
bd5af74
to
6a8308d
Compare
The `PushOffsetIntoIndexJoin` rule has been added that pushes Offset expressions below IndexJoin expressions. It is very similar to `PushLimitIntoIndexJoin`. Fixes cockroachdb#121157 Release note (performance improvement): The optimizer now generates more efficient query plans for some queries with `OFFSET` clauses.
6a8308d
to
1e4be65
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.
Reviewed 1 of 2 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @mgartner and @rytaft)
TFTRs! bors r+ |
We typically don't backport things that can change query plans unless they are disabled by default. I'm not inclined to go through that effort unless there's a strong need for it. |
@yuzefovich I take that back. We've seen some users run into this on v23.2, so I'll backport this behind a session setting. |
The
PushOffsetIntoIndexJoin
rule has been added that pushes Offsetexpressions below IndexJoin expressions. It is very similar to
PushLimitIntoIndexJoin
.Fixes #121157
Release note (performance improvement): The optimizer now generates more
efficient query plans for some queries with
OFFSET
clauses.