citusdata / citusdata/citus

Poor join order plan when reference tables involved, leading to unnecessary repartitioning.

Open
#6,865 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

```SQL
CREATE TABLE dist1(id int);
SELECT create_distributed_table('dist1', 'id');

CREATE TABLE dist1(id int);
SELECT create_distributed_table('dist2', 'id');

SELECT table_0.id
FROM ref0 AS table_0
INNER JOIN dist2 AS table_1 USING (id)
INNER JOIN dist1 AS table_2 USING (id)
;
LOG: join order: [ "dist2" ][ reference join "ref0" ][ dual partition join "dist1" ]
```

I'd expected
` [ "dist2" ][local partition join dist_1] [ reference join "ref0" ]` or `
LOG: join order: [ "dist1" ][ reference join "ref0" ][ local partition join "dist2" ]`

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.