-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
planner: the optimizer cannot convert OUTER JOIN to INNER JOIN with nested AND/OR predicates in some cases #49616
Comments
|
/type regression |
…o INNER JOIN with nested AND/OR in some cases (pingcap#49648) close pingcap#49616
Regression Analysis |
mysql> explain select /*+ tidb_inlj(t2, t1) */ * mysql> select tidb_version(); |
mysql> explain select /*+ tidb_inlj(t2, t1) */ * mysql> select tidb_version(); |
/type performance |
/found customer |
Enhancement
In the case above, the
tidb_inlj
hint doesn't take effect, because the optimizer cannot convert this OUTER JOIN into an INNER JOIN, since the predicatea>0 or (a=0 and b>0)
doesn't pass the null-rejective check (seeisNullRejected
,evaluateExprWithNullInNullRejectCheck
).But actually, the predicate is null-rejective since no matter the value of
b
, ifa
isnull
, then the eventual value of this predicate isnull
, and so all unmatched OUTER JOIN rows (whosea
isnull
) will be eliminated by this predicate. So it's safe to convert this OUTER JOIN to an INNER JOIN, but the optimizer didn't recognize this.This issue is caused by #38430, our current null-rejective check is too strict.
The text was updated successfully, but these errors were encountered: