Skip to content

MDEV-37029 Make vcol rewrite handle row-based INs #4131

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

Open
wants to merge 1 commit into
base: mdev-35913-comparator-assertion
Choose a base branch
from

Conversation

DaveGosselin-MariaDB
Copy link
Member

@DaveGosselin-MariaDB DaveGosselin-MariaDB commented Jun 20, 2025

Queries having the form

  select * from t1 where (a+1, b) IN ((1,1),(2,2),(3,3));

where a+1 is a virtual column will now be optimized to use that virtual column such that the above becomes

  select * from t1 where (vcol, b) IN ((1,1),(2,2),(3,3));

In general, vcol substitution will occur when a row itself contains the matching vcol expression. The optimizer will not only inspect the left-hand argument to IN for the matching expression, but will also unpack and inspect the left-hand argument when it is a row.

Queries having the form
  select * from t1 where (a+1, b) IN ((1,1),(2,2),(3,3));
where a+1 is a virtual column will now be optimized to use that
virtual column such that the above becomes
  select * from t1 where (vcol, b) IN ((1,1),(2,2),(3,3));

In general, vcol substitution will occur when a row itself contains
the matching vcol expression.  The optimizer will not only inspect
the left-hand argument to IN for the matching expression, but will
also unpack and inspect the left-hand argument when it is a row.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant