-
Notifications
You must be signed in to change notification settings - Fork 4k
release-24.3: lookup join: add a cast when mapping references in computed columns #152630
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
Conversation
Previously, when using a lookup join on an index with a virtual column, we would require the references inside that virtual column to be typed identically on the left and right side. This was a change from our previous behavior, which was to require they be equivalent, but not identical. This tightening of the requirements was done to address issue 124732, which pertains to virtual columns using functions that are senstive to the actual type of the input (e.g. 'pg_typeof'). By tightening the reference requirement, we excluded a set of queries from using lookup joins that had previously been able to do so safely, regressing their performance. In this patch, we add a cast around the left hand side reference to the right hand side's type, so that type sensitive functions return the correct type. This allows us to go back to the old behavior of allowing the types of these references to be equivalent rather than identical. Fixes: #147642 Informs: #124732 Release note (performance improvement): Lookup joins can now be used on tables with virtual columns even if the type of the search argument is not identical to the column type referenced in the virtual column.
846f1be
to
471bb52
Compare
Thanks for opening a backport. Before merging, please confirm that it falls into one of the following categories (select one):
Add a brief release justification to the PR description explaining your selection. Also, confirm that the change does not break backward compatibility and complies with all aspects of the backport policy. All backports must be reviewed by the TL and EM for the owning area. |
❌ PR #152630 does not comply with backport policy Confidence: high 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
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.
@michae2 reviewed 3 of 3 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball, @rytaft, and @yuzefovich)
Backport 1/1 commits from #152399 on behalf of @mw5h.
Previously, when using a lookup join on an index with a virtual column,
we would require the references inside that virtual column to be typed
identically on the left and right side. This was a change from our
previous behavior, which was to require they be equivalent, but not
identical. This tightening of the requirements was done to address issue
124732, which pertains to virtual columns using functions that are
senstive to the actual type of the input (e.g. 'pg_typeof').
By tightening the reference requirement, we excluded a set of queries
from using lookup joins that had previously been able to do so safely,
regressing their performance.
In this patch, we add a cast around the left hand side reference to the
right hand side's type, so that type sensitive functions return the
correct type. This allows us to go back to the old behavior of allowing
the types of these references to be equivalent rather than identical.
Fixes: #124732
Release note (performance improvement): Lookup joins can now be used on
tables with virtual columns even if the type of the search argument is
not identical to the column type referenced in the virtual column.
Release justification: Fixes a performance regression seen by a customer.