QueryBrew lets PostgreSQL and ClickHouse borrow Umbra's query optimizer
QueryBrew: System-Agnostic SQL-to-SQL Query Optimization [pdf]
QueryBrew is a system-agnostic optimization service that rewrites SQL into SQL: it feeds a query to the state-of-the-art Umbra optimizer, then distills the resulting plan back into operator-oriented SQL using one CTE per operator. Any target database — PostgreSQL, DuckDB, ClickHouse, or SQL Server — can inherit general unnesting, simplification, and adaptive join ordering without modification. On correlated and many-join queries, runtimes improve by more than an order of magnitude; ClickHouse even returned a wrong result on the original query but the correct one after optimization.
To our surprise, ClickHouse (version 25.11) returns the wrong result for the original query; however, running the optimized version produces the correct result.
- schultzer
It’s not clear from the paper or their website how it works, the paper seams to talk about an optimizer where the websites states its AI maybe this is just slop. Hard to determine when skimming it, although seams like a neat idea if it’s a proper engine and not just AI that anyone could copy and paste into a chat with the statistics.
- remywang
Very practical approach to “query optimizer as a service”, but I find it cursed that we have decided SQL is the IR for databases