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
Take the following SQL as an example: select * from left_table l join right_table r on l.k1 = r.v1 or l.k1 = r.v2
currently, we will rewrite the join type to nestloop join. This performance is relatively poor.
Actually, we can rewrite this sql to
select * from left_table l join right_table r on l.k1 = r.v1 and l.k1 = r.k2
union all
select * from left_table l join right_table r on l.k1 != r.v1 and l.k1 = r.k2
union all
select * from left_table l join right_table r on l.k1 = r.v1 and l.k1 != r.k2
we want to rewrite join on or predicate to union all. this will have a higher performance than nest loop join.
you could write a rule to rewrite this kind query.
you need to test whether the performance is better than nest loop join in the following two case:
multiple or predicate
non-related equal predicate like on l.k1 = r.v1 or l.k2 = r.v2
The text was updated successfully, but these errors were encountered:
Enhancement
Take the following SQL as an example:
select * from left_table l join right_table r on l.k1 = r.v1 or l.k1 = r.v2
currently, we will rewrite the join type to nestloop join. This performance is relatively poor.
Actually, we can rewrite this sql to
we want to rewrite join on or predicate to union all. this will have a higher performance than nest loop join.
you could write a rule to rewrite this kind query.
you need to test whether the performance is better than nest loop join in the following two case:
on l.k1 = r.v1 or l.k2 = r.v2
The text was updated successfully, but these errors were encountered: