Skip to content

LIMIT and ORDER BY pushdown in ASOF queries #5647

@jerrinot

Description

@jerrinot

Is your feature request related to a problem?

Consider this query:

SELECT *
FROM orders o
ASOF JOIN market_data md on o.order_symbol = md.market_data_symbol
ORDER BY o.ts DESC
LIMIT 100;

It first executes ASOF join and then sorts and limits the result:

Image

Describe the solution you'd like.

The query only uses columns from the master table for ordering -> It should be possible to push both the LIMIT and ORDER BY down to the master factory and execute it before the join. The join operator would have to join just 100 rows.

Describe alternatives you've considered.

No response

Full Name:

Jaromir Hamala

Affiliation:

QuestDB

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    New featureFeature requestsPerformancePerformance improvementsSQLIssues or changes relating to SQL execution
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions