Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-step execution #684

Open
findepi opened this issue Apr 27, 2019 · 2 comments
Open

Multi-step execution #684

findepi opened this issue Apr 27, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@findepi
Copy link
Member

findepi commented Apr 27, 2019

Certain queries would benefit from materializing part of the query (even if only in memory) and re-planning the rest.
Typical case is a query over partitioned table where partitioning key column filter is dynamically evaluated:

SELECT ...
FROM table WHERE partition_key = (SELECT .... )
@sopel39
Copy link
Member

sopel39 commented Apr 29, 2019

For multi-step execution we could have a series of plannings: e.g:

P -> (plan and extract partial queries) -> P2, [Q1, Q2, ...Qn]
  -> (plan and extract partial queries) -> P3, [Q(n+1), Q(n+2), ... Q(n+m)] 
  -> []

So for initial plan P we extract some partial queries Q1, ..., Qn which are fully executed. Then we replan again (with new statistics) and extract further partial queries Q(n+1), ... Q(n+m). We repeat that until we fully consume plan P (e.g: P -> P1 -> P2 -> ... -> Pi -> []).

It seems that there could be some object above SqlQueryManager that would implement such multi-stage iterative approach. For example there could be some: SqlMultiStageQueryManager that owns multiple SqlQueryManager for currently running partial query executions.

Temp tables

As part of planning we could identify which subplans quality for materialization via temp tables, e.g: via TempTablePlanNode. Such TempTablePlanNode would be natural candidates for partial queries in the iterative process above. The plan would be a DAG for moment, but that is probably not an issue.

@findepi findepi changed the title Multi-step execution Phased (multi-step) execution Aug 7, 2019
@findepi findepi changed the title Phased (multi-step) execution Multi-step execution Aug 7, 2019
@findepi findepi added the enhancement New feature or request label Jan 12, 2022
@findepi
Copy link
Member Author

findepi commented Jan 12, 2022

cc @losipiuk @arhimondr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants