v.22.7Improvement
New optimize = 1 Option in EXPLAIN AST for Rewritten AST Display
New optionoptimize = 1inEXPLAIN AST. If enabled, it shows AST after it's rewritten, otherwise AST of original query. Disabled by default. #38910 (Igor Nikonov).
Why it matters
This feature allows users to see the optimized version of the AST after the query has been rewritten by ClickHouse. It helps in understanding how the query planner transforms the query internally, which can be valuable for debugging and query optimization.How to use it
Use theEXPLAIN AST statement with the option optimize = 1 to display the rewritten AST. By default, this option is disabled and shows the original AST. Example:EXPLAIN AST optimize = 1 <query>