Why successful SQL can still leave a stale report
A shop manager opens a sales report each morning to decide what stock to order. The report loads, but it shows yesterday’s numbers. A successful database query only proves someone could read the report. It cannot prove today’s records arrived, passed checks and were published.
Monitoring checks a question you already know to ask, such as “Is the last finished batch still yesterday?” Observability lets you follow the same batch through file delivery, loading and transformation to find a cause you did not predict. For example, a warehouse could be healthy while a new missing amount prevents publication.
Availability means the service can answer an intended request. Freshness means the result reflects recent source data. Reliability means it keeps giving the correct outcome over time. You can measure each separately. Pick the source timestamp that the business cares about and compare it with the last published source timestamp. A recent write to the target says little if that write only republished old records.
- Source deliverySend to Ingestion
- IngestionLoad and check to Checked and published table
- Checked and published tableMeasure delivery to Dashboard and on-call owner
- Source delivery
- An expected file or set of changes arrives with a batch identifier.
- Ingestion
- Snowflake receives rows and reports accepted or rejected input.
- Checked and published table
- The team reconciles amounts and publishes the expected batch.
- Dashboard and on-call owner
- A delivery check shows the missed promise and links to evidence.
Choose a metric, log, event or trace
A metric is a number measured repeatedly, such as how many batches arrived late each week. A log adds context in a record such as “B102 has a missing sales amount.” An event marks something that happened, such as “task started” or “batch rejected.” A trace follows one piece of work through smaller timed steps, called spans. A loading span might take 8 seconds while a transformation span takes 83 seconds.
Use metrics to spot a trend or trigger an alert. Use logs and events to see what a specific step recorded. Use traces to find where time went or where work stopped. An application can add the same batch ID to its logs and audit rows. Snowflake will not automatically attach your business batch ID to every job, file or client request.
| Signal | Example | Next question |
|---|---|---|
| Metric | 1 late batch this morning | Has this started happening more often? |
| Log | B102 rejected because amount is missing | Which source delivery contained it? |
| Event | B102 task started at 07:50 | What did the task do next? |
| Trace | Validate took 2 s, publish never started | Why did the validation step stop the run? |
Measure SLI, SLO and SLA with the same rule
Maple Market counts one delivery per day. The indicator is the percentage of expected batches verified and published by 08:00 UTC. The team sets an internal objective of 99% per calendar month and promises business users a 95% monthly minimum in an example agreement. That agreement also names the owner and what happens after a breach. The 08:00 cutoff determines the result for each day.
The sample below includes an expected batch that never appeared and therefore has no publication time. Put expected deliveries in the denominator. Otherwise, complete failures disappear from the metric. Use Coordinated Universal Time (UTC) consistently and define how holidays, zero-volume deliveries and maintenance are counted. Choose a minimum sample size before responding to a percentage.
- Define the rows as expected deliveries first. A missing publication is still an expected delivery.
- The comparison credits B101 only. B102 arrived 12 minutes late, and the missing B103 timestamp makes its comparison unknown.
- Divide the one success by all three expected deliveries. Use a full reporting period when judging the monthly objective.
| EXPECTED_BATCHES | ON_TIME | ON_TIME_PCT |
|---|---|---|
| 3 | 1 | 33.33 |
WITH deliveries(batch_id, due_text, published_text) AS (
SELECT * FROM VALUES
('B101', '2026-12-01 08:00:00', '2026-12-01 07:52:00'),
('B102', '2026-12-02 08:00:00', '2026-12-02 08:12:00'),
('B103', '2026-12-03 08:00:00', NULL)
)
SELECT COUNT(*) AS expected_batches,
COALESCE(COUNT_IF(TO_TIMESTAMP_NTZ(published_text) <= TO_TIMESTAMP_NTZ(due_text)), 0) AS on_time,
ROUND(100.0 * COALESCE(COUNT_IF(TO_TIMESTAMP_NTZ(published_text) <= TO_TIMESTAMP_NTZ(due_text)), 0)
/ NULLIF(COUNT(*), 0), 2) AS on_time_pct
FROM deliveries;Act before users notice and investigate after a breach
Proactive checks run before the deadline, such as a warning when the source file is still missing at 07:45. Reactive checks respond to a breach or a user report. Use both. An early warning gives the team time to recover, while a breach record shows the impact to consumers.
Give each step an owner. The source team confirms the delivery, the data engineering team checks publication, and the on-call engineer keeps incident records and coordinates the retry. The business owner sets acceptable freshness. Run monitoring on a path with its own heartbeat so a stopped task or broken dashboard cannot hide a problem.
Interview practice
Explain the decision and the evidence you would use to test it.
Beginner · What is the difference between monitoring and observability?
I monitor the known 08:00 deadline. When it fails, I use records from the whole path, linked by batch ID, to find out why.
SQL · How do you count a delivery that never arrived?
I start from the schedule of expected batches and left join to verified publications. I count all scheduled rows as the denominator and count only publications on or before the cutoff as successes.
Production · A task is green and the report is stale. What now?
I compare the expected and published batch IDs. Then I walk backwards through validation, transformation and source arrival. A task can complete normally while it produces no changes or records a failed business check.
Words used in this lesson
- Monitoring
- Checking known conditions repeatedly and telling someone when one crosses a limit.
- Observability
- Using the evidence a system leaves behind to work out what happened, even when you did not predict the cause.
- Telemetry
- The signals emitted by a system, such as counts, messages and records of work.
- SLI, SLO and SLA
- The service level indicator is the measurement, the service level objective is its target and the service level agreement is an agreed commitment.
Try the SQL or command
Read → predict → run in your learning environment → compare. You can also learn by reading without an account.
Use the SQL and expected outputs in the sections above.
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.
Before running this lesson
Maple Market is fictional. Output tables are representative. Live commands require an authorized test account and the roles, compute and edition listed in each lesson.
Check your understanding
Choose an answer, then check your reasoning. This is practice, not a scored test.
Try it yourself
At 08:00, a report opens in one second and shows yesterday’s value. Which measure passes and which fails?
Compare your reasoning
The report is available to read. Freshness fails because the expected current batch was not published. Count it as a missed delivery even if no query failed.
Connect this lesson to the learning path
Official sources and curriculum
Module 20 · See module scope
By Rohit Ray · Independent educational lesson · Explore this visual lab