Your brief from Maple Market
Finance reports a jump from 8 to 13 billed compute credits. Both days completed the same delivery schedule. Orders ELT is the extract, load and transform pipeline that prepares the orders for reporting. BI is the business intelligence warehouse used by dashboard readers. The overnight orders job must finish within 120 seconds and return the same two daily order totals. The ingestion feed has a separate freshness requirement. Your job is to explain the increase and recommend one first experiment.
Run the three worked statements in order or read their result tables. They use fictional rows and regular SELECT statements. They need no permanent objects, Snowflake usage data or paid features. Running them in a real Snowflake account still requires approved compute and can consume credits. The read-only fixture needs no configuration. Follow the separate optional canary only in an approved disposable environment.
Trace the five-credit increase to two owners
The first input is already reconciled billed compute. Each row is one service or workload bucket with two closed-day totals. The warehouse buckets represent a drill-down of the warehouse service, with no billed Cloud Services in this fixture. In your own account keep the initial service totals separate from the warehouse drill-down.
Use the first query to verify the five-credit change before naming a cause. Orders ELT contributes four additional credits, or 80% of the net increase. Automatic Clustering contributes one. Ingestion and BI each hold steady.
In the second query, each row contains one reconciled warehouse day. Query-attributed compute grows by 2 credits and idle by 2. The overnight warehouse had a longer idle setting in the later period according to the fixture incident notes. Verify that hypothesis against warehouse resume and suspend times in a live investigation. Ask the clustering owner separately about data churn and when the feature was enabled.
Make the first change testable
The benchmark fixture holds the successful output and deadline fixed while estimating compute for one Gen1 single-cluster interval. The order totals should be 40 for Store A and 60 for Store B. Compare the result for each store. In production also compare key coverage, duplicate keys and full result rows at the expected grain. In this fixture the result columns already contain one total per store.
The isolated baseline is a Small run that executes in 80 seconds and keeps compute running for another 120 seconds. Candidate B retains the size and output and tests a 60-second observed tail. Candidate C is cheaper on paper, but finishes in 180 seconds. Candidate D changes a store’s result. Choose a candidate only after checking both delivery and output.
Recommend Candidate B as a canary for the batch. Its estimate is about 0.077778 credits per run versus 0.111111 for the isolated baseline, a 30% reduction before other usage. That estimate belongs to the benchmark and cannot be multiplied straight into the daily incident without checking starts, overlap and the actual run count.
Give the warehouse owner a rollback to the prior idle setting. Over comparable runs, record exact output, job deadlines, restart and queue delays and credits per successful batch. Re-check warehouse metering after its delay. Keep the clustering credit increase with its owner until that investigation has evidence.
| Record | Expected lab evidence |
|---|---|
| Incident amount and scope | +5 billed compute credits over two comparable closed days |
| Top contributors | +4 Orders ELT and +1 Automatic Clustering |
| Warehouse explanation | +2 attributed query compute and +2 idle |
| First experiment and protection | Candidate B, with equal output and 120-second deadline |
| Follow-up | Inspect clustering maintenance separately and verify the canary with observed metering |
Follow the twelve steps from the bill to a safer rollout
This incident uses fictional usage and monitoring results. Read the figures as a completed practice case. The three original worked statements under Try the SQL check the billed drill-down, the warehouse split and the candidate estimates. The independent queries below add service ranking, query behavior, storage and the verification plan. You can run the fixture SQL with approved Snowflake compute or read the result tables.
The optional live steps use separate disposable resources and require approval from the warehouse and billing owners. A normal analyst can review results with the authorized Account Usage views. Warehouse configuration requires the appropriate warehouse authority. A live read or test can consume credits.
| Step | Evidence for this incident | What to do |
|---|---|---|
| 1. Verify the increase | 8 → 13 billed credits on comparable UTC days | Use a complete, comparable window and hold the unit fixed. |
| 2. Rank services | Warehouse +4, clustering +1, file-based Snowpipe flat | Start with warehouse compute. |
| 3. Rank warehouses | ORDERS_ELT +4, BI flat | Open Orders ELT and compare the same completed schedule. |
| 4. Look at costly work | Nightly merge accounts for the extra 2 attributed credits | Identify the query family and owner. |
| 5. Separate idle, queues and spill | Idle +2, spill on the merge, little overload | Test the idle setting first and investigate merge execution separately. |
| 6. Check the other bills | Clustering +1, Snowpipe steady, average storage 200 GiB in both windows | Keep feature maintenance with its owner. Price storage separately. |
| 7. Establish the canary baseline | Small: 80 seconds execution, 120 seconds idle tail | Compare the same output and job deadline. |
| 8. Choose one change | Candidate B shortens the idle tail | Keep size, output and inputs fixed. |
| 9. Test safely | Canary on an isolated warehouse | Record the old setting and rollback. |
| 10. Compare normalized cost | 0.111111 → 0.077778 estimated credits per valid batch | Confirm observed metering and elapsed time before claiming savings. |
| 11. Prevent recurrence | Quota notification plus supported budget forecast | Verify alert scope and delivery. |
| 12. Document the decision | Warehouse experiment approved for review. Clustering investigation open. | Record owners, dates, query IDs, estimates and observed outcomes. |
- Daily billed computeTrace warehouse service to Orders ELT execution and idle
- Daily billed computeInspect other meters separately to Clustering, ingestion and storage
- Orders ELT execution and idleChoose the idle-tail hypothesis to One controlled canary
- One controlled canaryCompare matched successful runs to Output, timing and confirmed credits
Work through the simulated service and query evidence
The first group has three billed service buckets and storage measured in GiB. The second group has attributed warehouse execution only. Do not add those credits to the bill again. Their sum reconciles to the query component of Orders ELT. Read both groups before proposing an optimization.
Run warehouse idle and query investigation SQL →
Inspect maintenance and refresh cost sources →
Rank the service deltas and check storage separately
One fixture row is one metric for the baseline and recent window. The billed-credit delta is 5 across the service rows. Within those rows WAREHOUSE_METERING moves 6 to 10, which the original step 1 traces to Orders ELT. Clustering moves 1 to 2 and PIPE remains 1. Storage stays at 200 GiB. Its units are printed so the volume stays outside the credit total.
WITH measures AS (
SELECT column1 AS metric, column2 AS unit, column3 AS baseline, column4 AS recent
FROM VALUES ('WAREHOUSE_METERING','billed credits',6,10),
('AUTO_CLUSTERING','billed credits',1,2),
('PIPE','billed credits',1,1),
('STANDARD_STORAGE','GiB average',200,200)
)
SELECT metric, unit, baseline, recent, recent - baseline AS delta,
SUM(recent - baseline) OVER (PARTITION BY unit) AS delta_in_unit
FROM measures ORDER BY unit, delta DESC, metric;Find the query family behind the extra execution credits
Each row represents an illustrative query-family summary for Orders ELT in a full day. The merge grows from 2 to 4 execution credits and from zero to 2 GiB remote spill. Its overload stays at 20 ms. The report check stays at 1 credit. This makes join growth a better next hypothesis than concurrency for the merge. The separately metered rise in warehouse idle still deserves the first low-impact trial.
WITH query_groups AS (
SELECT column1 AS phase, column2 AS workload,
column3 AS execution_credits, column4 AS overload_p50_ms,
column5 AS remote_spill_gib
FROM VALUES ('baseline','ORDERS_MERGE',2,20,0),
('recent','ORDERS_MERGE',4,20,2),
('baseline','REPORT_CHECK',1,0,0),
('recent','REPORT_CHECK',1,0,0)
)
SELECT workload,
SUM(CASE WHEN phase = 'baseline' THEN execution_credits ELSE 0 END) AS baseline_credits,
SUM(CASE WHEN phase = 'recent' THEN execution_credits ELSE 0 END) AS recent_credits,
MAX(CASE WHEN phase = 'recent' THEN overload_p50_ms END) AS recent_overload_ms,
MAX(CASE WHEN phase = 'recent' THEN remote_spill_gib END) AS recent_remote_spill_gib
FROM query_groups GROUP BY workload ORDER BY recent_credits DESC;Look up the same units in an authorized account
These queries are optional replacements for the representative evidence. Align dates across the account, warehouse and feature queries. Compare storage by daily average compressed bytes. Inspect the affected cluster table or pipe through the relevant lesson. This worksheet does not change account settings.
ALTER SESSION SET TIMEZONE = 'UTC';
SELECT usage_date, service_type, SUM(credits_billed) AS billed_credits
FROM SNOWFLAKE.ACCOUNT_USAGE.METERING_DAILY_HISTORY
WHERE usage_date >= '2026-10-12'::DATE AND usage_date < '2026-10-14'::DATE
GROUP BY usage_date, service_type ORDER BY usage_date, billed_credits DESC;
SELECT usage_date, storage_bytes / POWER(1024,3) AS table_gib,
stage_bytes / POWER(1024,3) AS stage_gib,
failsafe_bytes / POWER(1024,3) AS failsafe_gib
FROM SNOWFLAKE.ACCOUNT_USAGE.STORAGE_USAGE
WHERE usage_date >= '2026-10-12'::DATE AND usage_date < '2026-10-14'::DATE
ORDER BY usage_date;Run one canary and reconcile what actually happened
Prepare a disposable Small warehouse, M16D_CANARY_WH, using the warehouse sizing lesson and an approved representative fixed input. The sample sandbox has four rows: A 15 and 25, B 20 and 40. It proves the expected totals of 40 and 60. The tiny fixture does not reproduce the hypothetical 80-second runtime. Use the same approved full input in both real trials for timing.
Keep size and cluster count fixed. Set auto-suspend to 120 for the baseline and to 60 for the candidate. Wait until the warehouse actually suspends after each workload before starting the next cold run. Use comparable input and cadence for repeat runs. Measure end-to-end time including queue and startup, validate identical result rows, and compare the observed credit change for the complete windows after metering catches up.
Create and size the disposable warehouse →
Verify Resource Monitor and Budget controls →
Run the same aggregation twice with different idle settings
Use a fresh session, a role with USAGE and MODIFY on the sandbox warehouse and CREATE TABLE on the lab schema for the temporary input. Create the small input on an existing approved worksheet warehouse before starting the two trials. Replace its name with the fixed benchmark input when measuring performance. The persisted result cache is disabled. Compare Query History by tag and the warehouse meter by timed window.
USE SCHEMA <LAB_DB>.<LAB_SCHEMA>;
CREATE TEMPORARY TABLE M16D_CANARY_INPUT (store_id VARCHAR, amount NUMBER);
INSERT INTO M16D_CANARY_INPUT VALUES ('A',15),('A',25),('B',20),('B',40);
USE WAREHOUSE M16D_CANARY_WH;
ALTER SESSION SET USE_CACHED_RESULT = FALSE;
ALTER WAREHOUSE M16D_CANARY_WH SET AUTO_SUSPEND = 120;
ALTER SESSION SET QUERY_TAG = 'M16D|CANARY|BASELINE';
SELECT store_id, SUM(amount) AS sales FROM M16D_CANARY_INPUT GROUP BY store_id ORDER BY store_id;
-- Wait for suspension and record the baseline time window before continuing.
ALTER WAREHOUSE M16D_CANARY_WH SET AUTO_SUSPEND = 60;
ALTER SESSION SET QUERY_TAG = 'M16D|CANARY|CANDIDATE';
SELECT store_id, SUM(amount) AS sales FROM M16D_CANARY_INPUT GROUP BY store_id ORDER BY store_id;
-- Wait for suspension and record the candidate window. Restore the pilot baseline if output or timing regresses.
ALTER WAREHOUSE M16D_CANARY_WH SET AUTO_SUSPEND = 120;
ALTER SESSION UNSET QUERY_TAG;
ALTER SESSION UNSET USE_CACHED_RESULT;
DROP TABLE M16D_CANARY_INPUT;Compare tagged runs using the actual execution records
Set the same closed UTC window used during the pilot. The recorded query count shows how many runs are in each sample. Use the query IDs and approved Query History access to verify successful and failed attempts. Compare elapsed time and overload for the same kind of run. Use whole-warehouse credits divided by successful batches for the financial comparison. Hourly metering cannot isolate two tests in the same hour, so use non-overlapping full reporting windows for that comparison and keep unrelated jobs off the pilot warehouse.
ALTER SESSION SET TIMEZONE = 'UTC';
SELECT query_tag, COUNT(*) AS succeeded,
MEDIAN(total_elapsed_time) / 1000 AS elapsed_p50_seconds,
MAX(total_elapsed_time) / 1000 AS max_elapsed_seconds,
SUM(queued_overload_time) / 1000 AS total_overload_seconds
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE warehouse_name = 'M16D_CANARY_WH'
AND start_time >= '<utc_start>'::TIMESTAMP_LTZ AND start_time < '<utc_end>'::TIMESTAMP_LTZ
AND query_type = 'SELECT' AND UPPER(execution_status) = 'SUCCESS'
AND query_tag IN ('M16D|CANARY|BASELINE', 'M16D|CANARY|CANDIDATE')
GROUP BY query_tag ORDER BY query_tag;Reconcile metered credits per valid batch
Fill in two non-overlapping, hour-aligned UTC windows and a validated batch count for each. These counts can differ. Count an execution as valid only after the output and delivery check passes. Keep a failed attempt’s compute in the numerator so retries still cost something.
The left join preserves a row when metering is missing. Leave the cost unknown until the data arrives. Compare actual credits per successful batch and report the difference only after checking warehouse configuration, workload scope and data volume.
ALTER SESSION SET TIMEZONE = 'UTC';
WITH windows AS (
SELECT 'baseline' AS phase, '<baseline_start>'::TIMESTAMP_LTZ AS lo,
'<baseline_end>'::TIMESTAMP_LTZ AS hi, <baseline_valid_count>::NUMBER AS valid_batches
UNION ALL
SELECT 'candidate', '<candidate_start>'::TIMESTAMP_LTZ,
'<candidate_end>'::TIMESTAMP_LTZ, <candidate_valid_count>::NUMBER
)
SELECT w.phase, w.valid_batches, COUNT(m.start_time) AS meter_rows,
SUM(m.credits_used_compute) AS warehouse_compute,
SUM(m.credits_used_compute) / NULLIF(w.valid_batches, 0) AS credits_per_valid_batch
FROM windows w LEFT JOIN SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY m
ON m.warehouse_name = 'M16D_CANARY_WH'
AND m.start_time >= w.lo AND m.start_time < w.hi
GROUP BY w.phase, w.valid_batches ORDER BY w.phase;Pilot a warning without disrupting the batch
Use ACCOUNTADMIN only in the approved disposable account. Give the isolated canary a notify-only pilot monitor. Verify the attachment and configure verified notification recipients through the guardrails lesson. That lesson also walks through a separate budget for supported serverless spend. Do not test by burning credits to hit the quota.
After the pilot, restore the warehouse’s former monitor if it had one. The example assumes none. Remove and drop only the pilot monitor. Have the owner drop the disposable canary warehouse after metering and any required evidence are collected.
USE ROLE ACCOUNTADMIN;
CREATE RESOURCE MONITOR M16D_CANARY_WARN WITH CREDIT_QUOTA = 10
FREQUENCY = MONTHLY START_TIMESTAMP = IMMEDIATELY
TRIGGERS ON 70 PERCENT DO NOTIFY;
ALTER WAREHOUSE M16D_CANARY_WH SET RESOURCE_MONITOR = M16D_CANARY_WARN;
SHOW RESOURCE MONITORS LIKE 'M16D_CANARY_WARN';
SHOW WAREHOUSES LIKE 'M16D_CANARY_WH';
-- After the pilot.
ALTER WAREHOUSE M16D_CANARY_WH UNSET RESOURCE_MONITOR;
DROP RESOURCE MONITOR M16D_CANARY_WARN;Write down the decision and follow-up
Finance explanation: the modeled bill rises by 5 credits. Orders ELT accounts for 4, divided equally between additional execution and idle. Clustering accounts for 1. File-pipe usage and storage were stable in the supplied window. The warehouse owner will test the shorter idle tail. The clustering owner will check the date of a recent backfill and its cost evidence.
Record the before and after window, query IDs, row totals and deadline, warehouse settings and credits per successful run. Mark all fixture results and the 30% canary saving as estimates. If any run misses 120 seconds or results differ, restore the 120-second idle setting and investigate. Follow up after the next complete meter refresh and update the ticket with observations and the final decision.
Explain the decision in an interview
Start with the rule, then say what you would check in a real account.
How would you reduce nightly ELT cost without breaking delivery?
I would baseline the full warehouse run, then change one thing. For this case I would test a shorter idle tail with the same input, result and deadline. I would use metering to confirm the difference.
The variance is five credits and your pilot saves 30%. What can Finance claim?
The fixture explains the five-credit variance, and the 30% describes one modeled run. I would wait for complete metering and compare successful production batches before forecasting a bill reduction.
What should a cost incident handoff contain?
I would give the next engineer the billing scope, evidence for each owner, the chosen test and rollback, and the exact checks for output, time and credits.
Words used in this lesson
- Canary
- A limited trial that exposes a change to a small portion of the workload.
- Rollback
- A planned return to the prior behavior if verification fails.
- Credits per successful run
- A cost measure that relates compute to completed work.
See how it works
Choose a step to explore the idea at your own pace.
Open the interactive explanation
Lab: investigate a cost spike and test a cheaper workload
Find the largest change
The five-credit increase splits into four for the Orders ELT warehouse and one for Automatic Clustering.
Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.
Read the complete diagram explanation
- Find the largest change
The five-credit increase splits into four for the Orders ELT warehouse and one for Automatic Clustering.
+5 billed → +4 Orders ELT → +1 clustering
- Split the warehouse increase
Separate the two additional execution credits from the two additional idle credits.
+4 warehouse → +2 execution → +2 idle
- Test the proposed change
Candidate B keeps both order totals and meets the deadline. Check these conditions again on the canary.
40 and 60 → 80 seconds → 0.077778 estimated credits
Try the SQL or command
Read → predict → run in your learning environment → compare. You can also learn by reading without an account.
New to SQL? Where to run it and how to read it
A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.
- No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
- For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
- Read the entire example, including comments beginning with
--. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor. - Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
- SELECT / FROM
- Choose the values to return / identify their input.
- VALUES / COLUMN1
- VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
- AS / WITH
- AS gives a result a readable name. WITH names a temporary query step within one statement.
- NULL / ::
- NULL means missing or unknown. The :: notation converts a value to a named data type.
- Session
- One connection and its settings. Keep related transaction steps in the same session.
- Database.schema.table
- A full address for stored data. It is separate from the warehouse that processes queries.
Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →
Help with common practice errors
- No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
- Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
- Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
- Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.
Step 1 · Rank the cost changes
WITH billed_usage AS (
SELECT column1 AS workload, column2 AS baseline_credits, column3 AS recent_credits
FROM VALUES ('Orders ELT', 4, 8),
('BI', 2, 2),
('Snowpipe', 1, 1),
('Automatic Clustering', 1, 2)
)
SELECT workload, baseline_credits, recent_credits,
recent_credits - baseline_credits AS delta_credits,
SUM(recent_credits - baseline_credits) OVER () AS total_delta
FROM billed_usage
ORDER BY delta_credits DESC, workload;What to expect and why
Subtract the baseline from the recent day for each bucket. The window sum repeats the incident-wide change so you can cross-check every row without losing the drill-down.
| WORKLOAD | BASELINE_CREDITS | RECENT_CREDITS | DELTA_CREDITS | TOTAL_DELTA |
|---|---|---|---|---|
| Orders ELT | 4 | 8 | 4 | 5 |
| Automatic Clustering | 1 | 2 | 1 | 5 |
| BI | 2 | 2 | 0 | 5 |
| Snowpipe | 1 | 1 | 0 | 5 |
Step 2 · Split Orders ELT into execution and idle
WITH warehouse_meter AS (
SELECT column1 AS period, column2 AS compute_credits, column3 AS query_credits
FROM VALUES ('A baseline', 4, 3),
('B recent', 8, 5)
)
SELECT period, compute_credits, query_credits,
compute_credits - query_credits AS idle_credits
FROM warehouse_meter
ORDER BY period;What to expect and why
The fixture represents closed hourly meter totals rolled up to each day. Subtract attributed execution for the same warehouse and window. The increase from 1 to 3 idle credits explains half of the warehouse’s increase.
| PERIOD | COMPUTE_CREDITS | QUERY_CREDITS | IDLE_CREDITS |
|---|---|---|---|
| A baseline | 4 | 3 | 1 |
| B recent | 8 | 5 | 3 |
Step 3 · Check the deadline and result before choosing a winner
WITH candidates AS (
SELECT column1 AS trial, column2 AS credits_per_hour,
column3 AS execution_seconds, column4 AS idle_tail_seconds,
column5 AS store_a, column6 AS store_b
FROM VALUES ('A Baseline Small', 2, 80, 120, 40, 60),
('B Shorter idle tail', 2, 80, 60, 40, 60),
('C X-Small', 1, 180, 60, 40, 60),
('D Changed result', 2, 70, 60, 40, 55)
)
SELECT trial, execution_seconds, store_a, store_b,
ROUND(credits_per_hour * GREATEST(execution_seconds + idle_tail_seconds, 60) / 3600, 6)
AS estimated_credits,
CASE
WHEN store_a IS NULL OR store_b IS NULL OR store_a <> 40 OR store_b <> 60 THEN 'Wrong result'
WHEN execution_seconds > 120 THEN 'Missed deadline'
ELSE 'Eligible'
END AS decision
FROM candidates
ORDER BY trial;What to expect and why
The fixture assumes no queue or startup wait. Use end-to-end elapsed time for a real deadline. Each row’s estimated credits uses the full running interval and billing minimum. Check both store totals before comparing eligible amounts.
| TRIAL | EXECUTION_SECONDS | STORE_A | STORE_B | ESTIMATED_CREDITS | DECISION |
|---|---|---|---|---|---|
| A Baseline Small | 80 | 40 | 60 | 0.111111 | Eligible |
| B Shorter idle tail | 80 | 40 | 60 | 0.077778 | Eligible |
| C X-Small | 180 | 40 | 60 | 0.066667 | Missed deadline |
| D Changed result | 70 | 40 | 55 | 0.072222 | Wrong result |
Check your understanding
Choose an answer, then check your reasoning. This is practice, not a scored test.
Try it yourself
Repeat the last step after changing the deadline to 75 seconds. Report the eligible candidates and explain what you would try next.
Compare your reasoning
No candidate is eligible. A and B exceed the deadline, C is slower still and D has the wrong output. Try improving the correct query or testing a different size, then rerun the correctness and cost checks.
Connect this lesson to the learning path
Official sources and curriculum
Module 16 · See module scope
By Rohit Ray · Independent educational lesson · Explore this visual lab