Skip to content

Idea: Incorporate ClickHouse ordering into query planner? #251

@theory

Description

@theory

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 PathKeys, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions