You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
select id, value from a group by id, value intersect select id, value from b group by id, value
if there is a lots of duplicate entries in table a and table b, this aggregation can help to improve the query performance a lot, and also save the memory usage a lot.
Even if user's query is
select id, value from a intersect all select id, value from b
The query can still be rewriten as
select id, value from a intersect all select id, value from b group by id, value
The text was updated successfully, but these errors were encountered:
This is just part of the semi-join to inner-join rewrite.
It is trivial, but it's cost based. (The rewrite is bad when the source is something like 1m rows with 0.9 million NDV)
So it's not done yet.
And another thing we need to notify is that the intersect is generating the join whose join key is nulleq not eq.
It also needs to be specially handled.
Enhancement
consider the case that
From mysql's doc(https://dev.mysql.com/doc/refman/9.0/en/intersect.html), if intersect means intersect distinct by default, so the above sql is the same as
if there is a lots of duplicate entries in table a and table b, this aggregation can help to improve the query performance a lot, and also save the memory usage a lot.
Even if user's query is
The query can still be rewriten as
The text was updated successfully, but these errors were encountered: