Skip to main content

Pillar 3 — Elimination

Principle: The cheapest query is the one you never run. Before optimizing work, remove the work that shouldn't happen at all.

Elimination is the highest-leverage pillar and the first two steps of the optimization hierarchysuspend and cache. Eliminating a query beats optimizing it every time: a rewrite makes a query 20% cheaper; a cache hit makes it free.

Why it matters

Two forms of pure waste dominate most Snowflake bills:

  1. Idle warehouse time — a warehouse left running with no queries still bills credits. Many warehouses are idle the majority of the day.
  2. Repeated identical work — dashboards, scheduled jobs, and CI re-run the same deterministic queries, each one resuming a warehouse and paying again for an answer that hasn't changed.

What to eliminate

WasteLeverchukei mechanism
Idle warehousesaggressive auto-suspendsuspend plugin
Repeated deterministic readsresult cachingverified cache
Concurrent identical queries (dashboard herds)request coalescingcoalescing
SELECT * scanning all columnscolumn pruning rewriterewrite plugin

Do / don't

DoDon't
Suspend idle warehouses aggressively (resume is fast)Leave warehouses running "to avoid resume latency"
Cache deterministic reads across users and toolsCache anything with RANDOM()/timestamps/writes
Collapse concurrent identical queriesLet a dashboard refresh wake a warehouse N times
Verify cache correctness continuouslyTrust a cache you can't audit

How chukei enforces it — safely

Elimination sounds risky ("what if the cache is wrong?"), so chukei makes it safe by construction. The cache is false-positive-intolerant: non-deterministic queries and writes are never cached, writes invalidate affected entries, and blame mode continuously re-checks a sample of cache hits against live Snowflake (measured record: 60,000 hits, 0 mismatches). If anything is uncertain, chukei fails open and runs the query normally.

Elimination checklist

  • Idle warehouses auto-suspend on a short timeout.
  • Deterministic reads are served from a verified cache.
  • Concurrent identical queries are coalesced into one execution.
  • Cache correctness is verified continuously, not assumed.
  • SELECT * over wide tables is flagged or rewritten.

Size the waste first. The replay simulator reports how much of your QUERY_HISTORY is cacheable and how much warehouse time is idle.