ClickHouse / ClickHouse/pg_clickhouse

Idea: Incorporate ClickHouse ordering into query planner?

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

Description

Currently, `get_useful_pathkeys_for_relation()` only examines the list of expressions in each `EquivalenceClass` `EquivalenceClass` for each desired pathkey to see if there is an expression supported by ClickHouse. If there are none, or if any cannot be pushed down, it doesn't create a `PathKey`.

If, however, the relation has only a single ClickHouse table it ought to be possible to report the underlying sort order of the ClickHouse table, so the planner can take it into consideration when planning a query. Doing so would likely require annotating foreign tables with the underlying sort order.

IOW, while a sequential scan in Postgres should have zero `PathKey`s, a sequential scan of a ClickHouse table should have one for each column by which the table id ordered (or clustered) — or, rather 2 for each column, one ASC and one DESC.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read get_useful_pathkeys_for_relation() and the handling of EquivalenceClass and PathKey first. Done means a single-table ClickHouse scan exposes the underlying table ordering as ascending and descending pathkeys so the PostgreSQL planner can use it.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.