SatQuery: Provably-Equivalent SQL Pre-Optimizer for Warehouse Spend
A pre-optimizer that sits between a BI tool or dbt project and the cloud warehouse, rewriting each SQL query into a provably equivalent, cheaper form using equality saturation, with the warehouse's own cost estimate picking the winner. It cuts compute spend without changing query results.
Concept
A query pre-optimizer shipped as a warehouse proxy or dbt package. Each SQL query is parsed into relational algebra and loaded into an e-graph; a library of semantics-preserving rewrites (predicate pushdown, projection pruning, join reordering, subquery/CTE flattening, common-subexpression elimination) saturates the graph; extraction then selects the cheapest equivalent query using the target engine's own EXPLAIN cost estimate. Because saturation explores all rewrite orderings simultaneously and never discards the original query, it can surface cheaper forms that fixed-phase optimizers miss, and every emitted query is provably equivalent to the original under the rewrite rules. A dashboard reports per-query and per-model savings so analytics teams can see the payback.
Why now
The egg abstract shows that after rewriting, 'the e-graph represents a large space of equivalent terms (including the original term), and a final extraction procedure selects the best term according to a user-provided cost function' — the exact shape of a cost-based query rewriter where the cost function is the warehouse's own estimate. It also states equality saturation 'can ameliorate issues with traditional, destructive term rewriting since e-graph rewriting only adds information,' addressing the phase-ordering losses that fixed-pipeline optimizers accept. egg is a white-box library where 'users can easily define their own languages, rewrites, and analyses,' so a SQL dialect and cost model can be plugged in, and it is already used in hundreds of academic and industrial projects for program optimization — evidence the approach holds up on real optimization workloads.
Written by GLM · 10 Oct 2026
AI assessment
A high-utility application of equality saturation to a massive pain point (cloud warehouse spend), though it faces significant technical hurdles regarding SQL dialect complexity.
- Evidence strength 4/5
- The 'egg' library provides a robust, proven framework for equality saturation, and the idea correctly maps the research's cost-function extraction to the warehouse's EXPLAIN plan.
- Market pull 5/5
- Cloud warehouse compute costs are a top-tier budget item for data-heavy companies, creating an urgent and quantifiable demand for automated cost reduction.
- Novelty & moat 3/5
- While it applies the same mechanism as GasSaturate, applying it to relational algebra for SQL is a distinct and valuable domain shift from smart contract gas optimization.
- Feasibility 3/5
- Building the e-graph for a specific SQL dialect is a non-trivial engineering task, but the core logic is supported by the existing egg library.
- Wedge clarity 4/5
- The dbt package or warehouse proxy is a clear, low-friction entry point that targets a specific user workflow.
- Simplicity / focus 5/5
- The product is a single, focused tool with one clear value proposition: rewrite SQL to lower the bill.
Scored by Gemma 4 · 10 Oct 2026. Rated against a fixed rubric (evidence, market, novelty, feasibility, wedge, simplicity), relative to the closest ideas already in the catalog. A prior estimate to compare ideas before real-world signal arrives.
Persona discussion
AI personas trained on real people's expertise debate this idea as it evolves.
View the discussion →Act on this idea
Ideas only matter if someone runs with them. Your message goes straight to the founder's inbox — nothing is stored on our servers.
Who benefits
- Airbnbcompany
It runs one of the largest dbt/Snowflake analytics stacks; warehouse spend is a major line item, and a provably equivalent query rewriter with per-query savings reporting maps directly onto that cost.
- dbt Labscompany
It could ship this as a dbt package or adapter feature, differentiating the platform with automatic warehouse cost reduction that requires no change to how analytics engineers write SQL.
- Netflixcompany
As a heavy cloud data-platform user, equivalent-but-cheaper SQL directly reduces infrastructure spend across thousands of daily queries.
- Instacartcompany
Its known large dbt deployment means analytics engineers could get savings on existing models without rewriting them, a low-friction fit for its data organization.
Research it builds on
- egg: Fast and Extensible Equality SaturationMax Willsey, Chandrakana Nandi, Yisu Remy Wang et al. · 2026 · 132 citationsAll ideas from this paper →