ClickHouse / ClickHouse/pg_clickhouse

Push down all JOIN expressions as JOIN expressions

Open
#253 0 comments 0 reactions 0 assignees View on GitHub
enhancement pushdown
Dominant language
C
Stars
283
Forks
21
Avg merge
2d 6h
Merged PRs (30d)
11

Description

Currently, `foreign_join_ok()` uses only [JOIN key expressions](https://clickhouse.com/docs/sql-reference/statements/select/join#on-section-conditions) in INNER JOIN and SEMI JOIN expressions: that is, only expressions that reference both the right and left keys using the equality operator. The rest are appended to remote conditions for use in the `WHERE` clause.

I suspect that ClickHouse used to allow only join key expressions but opened it up to additional expressions later. Today at least one must be a join key expression but other expressions are allowed.

Would it make sense to allow all expressions to be pushed down as JOIN expressions, rather than filtering some to remote conditions (the WHERE clause)? Seems like there might be some efficiencies in that, although maybe the ClickHouse optimizer adjusts appropriately to save cycles and iops?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing foreign_join_ok() and the code that moves non-key expressions into remote conditions. Compare how INNER JOIN and SEMI JOIN conditions are handled, then identify existing tests or query-planning checks for these paths; the issue is complete only when the intended pushdown behavior and its efficiency implications are established.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql, sql
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.