hydradatabase / hydradatabase/columnar

LEFT JOIN has poor/inconsistent performance

Open
#219 5 comments 0 reactions 0 assignees View on GitHub
enhancement needs repro
Dominant language
C
Stars
3k
Forks
106
PR merge metrics
No merged PRs in 30d

Description

### What's wrong?

I have 2 CTE and than a UNION ALL.
`WITH CTE1 as (SELECT * from Table1 Left Join Table2 where targetid in (1,2,3)),
CTE2 as (SELECT col1 from CTE1, left join lateral (select col2 from table2 where targetid =cte1.targetid) on true where point is null ) --this one has 0 ROWS
SELECT * FROM CTE1 WHERE point IS NOT NULL
UNION ALL
SELECT * FROM CTE2`

all selects are < 1 second and without UNION ALL separately they work ok.
When UNION ALL is applied a CTE scan operation makes a Index scan on Table2 and query takes > 6 seconds

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.