You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1(Pre). process cte at the optimizer phase not the binder phase
2. always inlining single-use CTEs
3. elimination of unused CTEs
4. push down predicates even without inlining ctes
For 4, there is an example:
WITH v as (SELECT i brand, i color FROM item WHERE i current price < 50)
SELECT * FROM v v1, v v2 WHERE v1.i brand = v2.i brand AND v1.i color = ’red’
AND v2.i color = ’blue’;
If v is materialized, we can still push down filter to the materialized cte, the pushed filter is v1.i color = ’red’ or v2.i color = ’blue’
After those rules, we can do tpcds benchmark for: 01, 02, 04, 05, 11, 14, 18, 22, 23, 24, 27, 30, 31, 36, 39, 47, 51, 58, 58, 64, 67, 70, 74, 75, 80, 83, 86, 95, 97.
Summary
Currently, M CTE relies on the
MATERIALIZED
keyword to enable.Add heuristic rules in the optimizer to make it adaptive, then users don't need to decide when to use materialized cte.
The text was updated successfully, but these errors were encountered: