sql/opt: version of SplitDisjunctionOfJoinTerms rule for left join #94382
Labels
A-sql-optimizer
SQL logical planning and optimizations.
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
O-support
Would prevent or help troubleshoot a customer escalation - bugs, missing observability/tooling, docs
P-3
Issues/test failures with no fix SLA
T-sql-queries
SQL Queries Team
In #74303 two new exploration rules were added,
SplitDisjunctionOfJoinTerms
andSplitDisjunctionOfAntiJoinTerms
, which split inner joins, semi joins, and anti joins with disjunctions in their join predicates into unioned joins. It would be nice to also have a version of this rule for left join (or other outer joins).Here's an example of a query that would benefit:
The plan for this query currently uses a cross join over a full table scan of
abc
:If we (incorrectly) rewrite the query to use
UNION
over two left joins, the plan looks much better (though it now generates different results):This exact rewrite won't usually work (in fact I think it's incorrect in this case), so I imagine this rule will be tricky to get right.
Jira issue: CRDB-22866
The text was updated successfully, but these errors were encountered: