promql-engine icon indicating copy to clipboard operation
promql-engine copied to clipboard

Add logical plan between AST and execution

Open fpetkovski opened this issue 3 years ago • 1 comments

We currently translate the AST directly to a physical plan. Having an in-between logical plan will allow us to run optimizers before the query is executed.

The logical plan would have a one to one mapping with the AST and will contain the parameters of each AST node. Query optimizers can then transform the logical plan based on predefined heuristics. One example would be optimizing series selects in binary operations so that we do as few network calls as possible.

Finally, we would build the physical plan from the optimized logical plan instead doing it from the AST directly.

image

fpetkovski avatar Sep 14 '22 07:09 fpetkovski

As discussed on Slack, https://github.com/thanos-io/thanos/issues/4407 this is something we can support when having the logical plan and optimizer.

yeya24 avatar Sep 28 '22 06:09 yeya24

I will close this as we already support logical plan

yeya24 avatar Apr 16 '25 06:04 yeya24