pushdown the correlated column condition to indexScan
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
``` sql
CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
);
CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
);
CREATE TABLE `t3` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
KEY `idx` (`b`,`a`)
);
desc select * from t1 where exists (select (select t3.b from t2, t3 where t3.a=t1.a and t2.b=t3.b and t2.a = 123) a) ;
```
The result plan:

We can see that the selection_28 has `t3.a=t1.a`, which can be used to build the index range in indexRangeScan_27
Contributor guide
Assessment
This issue has not been assessed yet.