citusdata / citusdata/citus

Support recursive planning of recurring inner joins when there is a reference to outer query

Open
#8,113 1 comment 0 reactions 0 assignees View on GitHub
feature
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

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.