-
Notifications
You must be signed in to change notification settings - Fork 5.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
Convert unique subquery directly to inner join #7395
Comments
This is a special case of #7205 , we need implement it first. Then use unique and not null information to remove the aggregation. |
Closed since #7205 is done. There may be some case that the aggregate doesn't be resolved successfully when the inner query is a little complex. |
Confirming the original case looks good:
Country.Code is the |
Please answer these questions before submitting your issue. Thanks!
Using the world sample database from MySQL, I tried this sample query:
Because Country.code is the primary key, I was expecting that TiDB would detect that the result set is guaranteed unique. Thus, the semi-join step is not required and the query could be converted directly to an INNER JOIN. I expect this type of query is common for developers who prefer subqueries over joins.
Semi-join.
tidb-server -V
or runselect tidb_version();
on TiDB)?The text was updated successfully, but these errors were encountered: