databend icon indicating copy to clipboard operation
databend copied to clipboard

Feature: optimize common table expression(CTE)

Open xudong963 opened this issue 3 years ago • 0 comments

Summary

Need RFC.

Currently, databend processes CTE by inlining all references to CTEs in the query tree.

This causes the CTE to execute multiple, but further optimization can be done with CTE in the context of the plan tree(such as join pushdown)

So we should leverage CBO to decide when to inline or not inline CTE.

There is a paper as reference: http://www.vldb.org/pvldb/vol8/p1704-elhelw.pdf

xudong963 avatar Aug 10 '22 07:08 xudong963