Support recursive planning of recurring inner joins when there is a reference to outer query
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
Currently, Citus can successfully execute queries with recurring left join with a reference to outer query via recursive planning. However, when the same subquery uses an INNER JOIN, recursive planning is not applied, and the query fails during planning.
```
Q1: Fails
SELECT COUNT(*) FROM dist_1 t1
WHERE NOT EXISTS (
SELECT * FROM ref_1 t3
JOIN dist_1 t2 USING (a)
WHERE t3.a = t1.a
);
ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
Q2: Works
SELECT COUNT(*) FROM dist_1 t1
WHERE NOT EXISTS (
SELECT * FROM ref_1 t3
LEFT JOIN dist_1 t2 USING (a)
WHERE t3.a = t1.a
);
```
Contributor guide
Assessment
This issue has not been assessed yet.