Skip to content

Convert inner joins to semi joins #22594

@neilconway

Description

@neilconway

Is your feature request related to a problem or challenge?

We can convert inner joins to semi joins automatically in some cases. For example, we can convert an inner join to a left semi join if

  • (1) Nothing above the join uses a column from the RHS of the join, and EITHER
  • (2) (A) The plan above the join is duplicate-insensitive (e.g., DISTINCT or some GROUP BYs), OR
  • (2) (B) We can use functional dependencies to prove that the RHS is unique on the join keys

And symmetrically for inner -> right semi for LHS.

Many of the TPC-DS queries would benefit from this. Plans in 2(A) generally benefit more because we're able to avoid producing duplicate tuples in the first place; 2(B) is a smaller win but still useful.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions