Pillar 1 — Visibility
Principle: You cannot reduce what you cannot see. Before any optimization, establish a per-query, per-warehouse, per-workload baseline of credit spend.
Visibility is the foundation pillar of the Snowflake Cost Optimization Framework. It is where most teams are strongest — and still incomplete, because account-level dashboards answer how much but not which query or whose.
Why it matters
Snowflake bills credits for warehouse time, not query work. A single poorly-written query that resumes an XL warehouse for its 60-second minimum can cost more than thousands of small queries. Without per-query visibility, that query is invisible inside a monthly warehouse total — so it never gets fixed.
What to measure
| Signal | Source | Tells you |
|---|---|---|
| Credits per warehouse over time | WAREHOUSE_METERING_HISTORY | where the money goes |
| Credits attributable per query | QUERY_HISTORY + execution time | which queries are expensive |
| Idle vs active warehouse time | WAREHOUSE_EVENTS_HISTORY | suspend opportunity |
| Repeated identical queries | query fingerprint | cache opportunity |
| Spend trend per workload | tagged QUERY_HISTORY | where growth is coming from |
Copy-paste recipe: most expensive queries last 30 days
-- Approximate credit cost per query family, last 30 days.
-- Attributes warehouse credits to queries by share of execution time.
with q as (
select
query_id,
query_text,
warehouse_name,
warehouse_size,
total_elapsed_time / 1000.0 as elapsed_s
from snowflake.account_usage.query_history
where start_time > dateadd('day', -30, current_timestamp())
and execution_status = 'SUCCESS'
)
select
warehouse_name,
warehouse_size,
any_value(left(query_text, 120)) as sample_sql,
count(*) as runs,
round(sum(elapsed_s), 1) as total_seconds,
round(sum(elapsed_s) / 3600, 2) as warehouse_hours
from q
group by warehouse_name, warehouse_size, hash(regexp_replace(upper(query_text), '\\s+', ' '))
order by total_seconds desc
limit 25;
This surfaces the queries worth attention. chukei takes the next step automatically: it computes a hard and soft fingerprint for every query at the proxy, so repeated and semantically-equivalent queries are grouped without you normalizing SQL by hand.
How chukei enforces it
The attribute plugin records every query's fingerprint, warehouse, client app, and the cache/rewrite/suspend decision applied — exported as Prometheus metrics and OpenTelemetry spans. You get per-query visibility live, not after the monthly close.
Visibility checklist
- A baseline of credits per warehouse for the last 90 days exists.
- You can list the top 25 most expensive query families on demand.
- Idle warehouse time is measured, not assumed.
- Repeated/duplicate queries are identified by fingerprint.
- Cost signals are refreshed continuously, not only at month end.
Related
- Next pillar: Attribution
- Snowflake FinOps guide
- Query fingerprinting
Get the baseline in minutes. The
replay simulator ingests your
QUERY_HISTORY and reports cacheable volume and idle time with no traffic change.