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
mysql> explain select * from t1 where t1.a not in (select a from t2);
+-----------------------+----------+------+------------------------------------------------------------------------+
| id | count | task | operator info |
+-----------------------+----------+------+------------------------------------------------------------------------+
| HashLeftJoin_8 | 8000.00 | root | anti semi join, inner:TableReader_12, equal:[eq(test.t1.a, test.t2.a)] |
| ├─TableReader_10 | 10000.00 | root | data:TableScan_9 |
| │ └─TableScan_9 | 10000.00 | cop | table:t1, range:[-inf,+inf], keep order:false, stats:pseudo |
| └─TableReader_12 | 10000.00 | root | data:TableScan_11 |
| └─TableScan_11 | 10000.00 | cop | table:t2, range:[-inf,+inf], keep order:false, stats:pseudo |
+-----------------------+----------+------+------------------------------------------------------------------------+
5 rows in set (0.00 sec)
These 2 are semantically equal, if we convert NOT EXISTS to anti semi join, we can apply more optimizations later such as constant propagation compared with outer join.
Feature Request
Is your feature request related to a problem? Please describe:
In current master branch,
NOT EXISTS
is implemented as left outer semi join with a NOT selection above it.while
NOT IN
is implemented as anti semi join:These 2 are semantically equal, if we convert
NOT EXISTS
to anti semi join, we can apply more optimizations later such as constant propagation compared with outer join.Describe the feature you'd like:
Implement
NOT EXISTS
as anti semi join.Describe alternatives you've considered:
N/A
Teachability, Documentation, Adoption, Migration Strategy:
N/A
The text was updated successfully, but these errors were encountered: