pingcap / pingcap/tidb

semi/anti-semi join too slow when join key has so many duplicated rows

Open
#34,038 4 comments 0 reactions 0 assignees View on GitHub
sig/execution type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement
semi/anti-semi join too slow when join key has so many duplicated rows

steps:
1.create table t2(a int AUTO_INCREMENT PRIMARY KEY,b int);
2. insert into t2(b) values(1);
3. /* do step-2 x times */
4. explain analyze select * from t2 where not exists (select NULL from t2 hehe where hehe.b=t2.b );
5. you will see `c.matchJoinKey` execute x^2 times in `for` loops in `(c *hashRowContainer) GetMatchedRowsAndPtrs`

related OnCall: https://internal.pingcap.net/jira/browse/ONCALL-4749

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.