Module 14 · Lesson 11 of 12Detailed study · about 25 min

Measure retained storage and write a recovery runbook

Recovery cost depends on changed and retained physical data, while recovery success depends on a tested decision process and reliable evidence.

Your learning goal

Read storage categories without double-counting logical clones, find incident evidence and write a recovery plan that handles missing history and conflicts.

Understand the idea

A concrete example

A QA clone is forgotten for months while the source is rewritten daily. Active row counts look stable, yet old data remains billable. Lowering retention without finding the clone may not solve the problem.

Key ideas in simple English
ConceptWhat it means
ACTIVE_BYTESStorage attributed to currently active data.
TIME_TRAVEL_BYTESHistorical data retained for self-service recovery.
FAILSAFE_BYTESPermanent-table history in Fail-safe.
RETAINED_FOR_CLONE_BYTESRetained data referenced by clones or other documented retention uses; not simply every clone’s logical size.

Remember: Recovery readiness combines suitable retention, reliable detection, scoped permissions and a rehearsed repair procedure. Record both correctness and cost consequences.

Explain it step by step · full theory

Learning objectives and prerequisites

Read storage categories without double-counting logical clones, find incident evidence and write a recovery plan that handles missing history and conflicts.

Build on Modules 02–04: storage, table types, SELECT, DML and transactions. Module 13 explains why recovery must preserve valid business history. Use the first lesson’s isolated setup; examples name separate demonstration tables so the baseline ORDERS stays unchanged.

Connect storage to workload behavior

A high-churn table can retain much more historical data than a mostly append-only table of the same active size. UPDATE and DELETE change managed storage; old versions can remain eligible even when current row counts fall. The important input is changed physical data, not just the number of SQL statements.

A clone initially reuses data, but its changes and retained references have storage consequences. Do not multiply the logical size of ORDERS by the number of clones and call that the bill. Use storage metrics and the clone ancestry identifiers to investigate physical attribution.

Read metrics with their limitations

SNOWFLAKE.ACCOUNT_USAGE.TABLE_STORAGE_METRICS reports table-level storage categories and clone group identity. The view can lag by up to 90 minutes. It can include dropped objects that still incur storage, so filtering only live tables can hide retained costs.

Access requires the appropriate SNOWFLAKE database visibility granted by your administrator. No rows or an authorization error is not proof that storage costs are zero. These four-row examples are too small to infer meaningful production cost or stable byte differences.

Estimate, then measure

A planning estimate can express incremental storage as changed compressed bytes retained across time plus clone divergence and other required history. It is not a billing formula: compression, shared references, cleanup timing and pricing rules matter. Actual monetary rates depend on contract, region and storage arrangements.

Compare the same inventory before and after a controlled retention/environment lifecycle change, wait for monitoring updates, and inspect the invoice/usage context. This lesson does not quote a universal storage price or promise an immediate credit saving from dropping a clone.

A recovery decision tree

Start with the least destructive action that preserves evidence. The runbook is a process, not a single SQL command.

  1. Record symptoms, affected business keys and the incident time zone.
  2. Identify exact objects, role, query IDs and transaction scope.
  3. Coordinate writers; preserve current and historical evidence where eligible.
  4. Choose row/column repair for DML, UNDROP for object loss, or a historical clone for investigation.
  5. Verify candidates, conflicts, duplicates and valid later changes.
  6. Validate inside the repair transaction; commit only when checks pass.
  7. Check downstream consumers and audit the decision before resuming jobs.
  8. If history is unavailable, escalate using the object-type recovery plan rather than repeatedly changing retention.

Troubleshoot from evidence

A failure message narrows the next question. Retrying a different restore command at random can make object identity harder to understand.

Common recovery failures
SymptomLikely investigationAvoid
Time Travel data unavailableRetention, creation time, table identity, typed timestampIncreasing retention and assuming old data returns
Statement not foundWrong ID/session or older than lookup windowUsing a later diagnostic ID
Object exists on UNDROPLive name conflictDropping valid replacement data
Historical clone failsOne child’s shorter retention or unsupported objectIgnoring children without documenting missing scope
Repair produces duplicatesCandidate uniqueness and concurrent writersRelying on an unenforced primary key
Storage stays high after DROPClone references, history and view latencyAssuming row deletion immediately removes billed bytes

Production decisions and common mistakes

Recovery readiness combines suitable retention, reliable detection, scoped permissions and a rehearsed repair procedure. Record both correctness and cost consequences.

Do not present a monitoring snapshot as a real-time bill or assume a successful DROP guarantees immediate physical deletion.

Key takeaways

Include incident/object identifiers, time zone, evidence snapshot, approved keys/columns, valid later changes, writer coordination, candidate checks, expected results, rollback choice, downstream checks and cleanup owner.

Words used in this lesson
Churn
How much stored data changes over time.
Attribution
Assigning measured usage to an object or workload.
Monitoring latency
Delay between activity and its appearance in a usage view.
Runbook
An operational procedure with evidence, decisions, validation and escalation.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 4

Measure retained storage and write a recovery runbook

Storage evidence
  • ACTIVE_BYTES
  • TIME_TRAVEL_BYTES
  • FAILSAFE_BYTES
  • RETAINED_FOR_CLONE_BYTES
Current / planned state

Measure four categories

Storage views distinguish active, Time Travel, Fail-safe and clone-retained bytes. Their updates can lag; row counts cannot predict compressed physical storage.

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
  1. Measure four categories

    Storage views distinguish active, Time Travel, Fail-safe and clone-retained bytes. Their updates can lag; row counts cannot predict compressed physical storage.

    • Storage evidence: ACTIVE_BYTES; TIME_TRAVEL_BYTES; FAILSAFE_BYTES; RETAINED_FOR_CLONE_BYTES
  2. High churn retains versions

    Repeatedly rewriting a large table can retain substantial old data even if the current row count stays constant. This is a workload effect, not a broken DELETE.

    • Active: Similar row count
    • History: More changed data retained
  3. A clone keeps a reference

    Dropping a source does not free blocks still needed by a clone. Remove unneeded QA objects after review, then allow retention and background cleanup to progress.

    • Dropped source: Not automatically zero storage
    • QA clone: Still references historical blocks
  4. Choose a recovery contract

    Set recovery windows and environment expiry with the business. A smaller storage bill is not a win if an irreplaceable order cannot be recovered in time.

    • Recovery need: Detection delay; Repair time
    • Cost decision: Change volume; Retention; Clone lifetime

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.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. 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.
  3. 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.
  4. 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

Manual Snowflake practice only; SQL has not been executed for this course. Use an authorized warehouse and role with access to L2_OBJECTS_LAB and CREATE SCHEMA/CREATE TABLE as needed. Run in M14_LAB, in one session with one writer, using autocommit unless a transaction is shown. Run CREATE once, never replace an existing production object. Standard Edition with one-day retention is sufficient for the main lab; longer retention and administrative monitoring have separate requirements.

Inspect delayed storage evidence

Definition: Storage categories are physical accounting signals, not row counts.

When to use: Optional administrator-granted ACCOUNT_USAGE visibility.

SQL · example
SELECT TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,ID,CLONE_GROUP_ID,
 TABLE_DROPPED,ACTIVE_BYTES,TIME_TRAVEL_BYTES,FAILSAFE_BYTES,RETAINED_FOR_CLONE_BYTES
FROM SNOWFLAKE.ACCOUNT_USAGE.TABLE_STORAGE_METRICS
WHERE TABLE_CATALOG='L2_OBJECTS_LAB'
 AND TABLE_SCHEMA IN ('M14_LAB','M14_QA','M14_QA_COPY')
ORDER BY TABLE_SCHEMA,TABLE_NAME,ID;

What to expect and why

Values depend on your account, timing and physical layout. No fabricated byte results are supplied. Compare IDs as well as names because multiple dropped/recreated versions can share a name.

Find this session’s incident statements

Definition: Session Query History helps recover a lost incident ID.

When to use: Run with the learning database selected; query text may contain sensitive literals in real systems.

SQL · example
SELECT QUERY_ID,START_TIME,END_TIME,QUERY_TYPE,QUERY_TEXT,EXECUTION_STATUS
FROM TABLE(L2_OBJECTS_LAB.INFORMATION_SCHEMA.QUERY_HISTORY_BY_SESSION(RESULT_LIMIT=>1000))
WHERE QUERY_TAG='learnsnowflake_m14'
ORDER BY START_TIME DESC;

What to expect and why

Locate the exact bad DML by object and predicate, not merely the latest DELETE. This is a bounded session-history result, not a complete account audit; query limits, retention and privileges affect visibility.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

You drop a source but an active clone still reads its old data. Is retained storage necessarily a bug?

Try it yourself

Write a recovery ticket with the minimum information another engineer needs to review your repair.

Compare your reasoning

Include incident/object identifiers, time zone, evidence snapshot, approved keys/columns, valid later changes, writer coordination, candidate checks, expected results, rollback choice, downstream checks and cleanup owner.

Key takeaway

Recovery readiness combines suitable retention, reliable detection, scoped permissions and a rehearsed repair procedure. Record both correctness and cost consequences.

Connect this lesson to the learning path

Official sources and curriculum

Module 14 · See module scope

By Rohit Ray · Independent educational lesson · Explore this visual lab