Module 14 · Lesson 8 of 12Detailed study · about 22 min

Zero-copy cloning: a new object sharing existing data

A zero-copy clone is an independent writable object that initially references the source’s existing data rather than copying every row.

Your learning goal

Create a table clone, compare it with CTAS, and choose a cloning scope that matches the environment you actually need.

Understand the idea

A concrete example

QA needs today’s orders to reproduce a transformation bug. A clone avoids copying the full order dataset up front; QA still needs its own access policy, warehouse choices and environment expiry.

Key ideas in simple English
ConceptWhat it means
CLONENew object, shared existing storage, independent future changes.
CTASRun a SELECT and materialize its result into a new table.
Schema cloneClone eligible objects within a schema, subject to support and privileges.
Database cloneBroader container clone; not a copy of the entire account.

Remember: Clone only what the investigation needs and review access before granting QA users permission.

Explain it step by step · full theory

Learning objectives and prerequisites

Create a table clone, compare it with CTAS, and choose a cloning scope that matches the environment you actually need.

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.

What zero-copy does and does not mean

Creating a clone establishes new object metadata that refers to existing storage. It is fast relative to rewriting large datasets, but the lesson makes no latency promise. Zero-copy describes data sharing at creation, not zero processing cost for later queries or maintenance.

A clone is not a view. A view evaluates its definition against referenced objects; a clone is an independent table state. Source updates do not automatically flow into the clone. To refresh QA, plan a new snapshot or an explicit data refresh process.

Choose CLONE or CTAS based on intent

Use CLONE when you want a supported object’s snapshot and table behavior. Use CREATE TABLE AS SELECT when you want a transformed or filtered result, such as anonymized or aggregated QA data. CTAS runs a query and materializes its output.

A clone still contains the original sensitive values unless governed appropriately. Do not give a test role access to customer data just because the object name ends in QA. For sensitive datasets, design masking or an approved transformed fixture before granting access.

Table, schema and database scope

A table clone is the smallest useful investigation unit. A schema clone can bring related supported objects together; a database clone spans its eligible schemas and children. Neither clones users, warehouses and all account configuration into a separate environment.

Container clones include objects only within documented support and the creating role’s privileges. Inventory the result. Clone success does not prove every operational dependency was copied or rebound to QA.

Privileges and lifecycle

Cloning a table requires SELECT on the source, access to the source containers and permission to create the destination table. Creating a schema/database clone needs its own creation and source/container privileges. Use a lab owner role; do not broaden production grants for convenience.

The clone has a new identity. Its own historical timeline begins at clone creation; it does not inherit the source’s entire older Time Travel history. The data snapshot may represent an earlier source state, but that is not the same as all older source versions becoming clone history.

Production decisions and common mistakes

Clone only what the investigation needs and review access before granting QA users permission.

Do not call a clone a continuously synchronized replica, a free environment or a clone of the entire Snowflake account.

Key takeaways

No. Prefer an approved transformed result or fixture with minimum necessary data. CLONE is valuable for snapshot fidelity, but does not itself reduce exposure or transform values.

Words used in this lesson
Clone
An independent object initially sharing eligible source data.
CTAS
CREATE TABLE AS SELECT; materialize a query result.
Metadata
Information describing an object and its data references.
Scope
The table, schema or database boundary being cloned.

See how it works

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

Open the interactive explanation
Interactive explainer1 / 3

Zero-copy cloning: a new object sharing existing data

ORDERS
  • A · orders 101/102
  • B · orders 103/104
Current / planned state

Source table

The source references conceptual blocks A and B. These letters represent shared immutable storage, not actual partition names.

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. Source table

    The source references conceptual blocks A and B. These letters represent shared immutable storage, not actual partition names.

    • ORDERS: A · orders 101/102; B · orders 103/104
  2. Create a zero-copy clone

    The new table receives its own identity and references the same existing data blocks. Cloning is not an INSERT SELECT that rewrites every source row.

    • ORDERS: A; B
    • ORDERS_QA: A · shared; B · shared
  3. Independent lifecycle

    The clone is not a live link to future source changes. Each table can be queried and changed separately; access and operational dependencies still need review.

    • Source: Own future writes
    • Clone: Own future writes
    • Storage: Shared until referenced blocks diverge

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.

Create and compare table copies

Definition: A clone shares existing data; CTAS materializes query results.

When to use: After lesson 1 with the unchanged ORDERS fixture.

SQL · example
USE SCHEMA L2_OBJECTS_LAB.M14_LAB;
CREATE TABLE ORDERS_QA CLONE ORDERS;
CREATE TABLE ORDERS_EAST_CTAS AS
 SELECT ORDER_ID,REGION,AMOUNT,STATUS FROM ORDERS WHERE REGION='east';
SELECT 'CLONE' AS OBJECT_KIND,COUNT(*) AS N,SUM(AMOUNT) AS TOTAL FROM ORDERS_QA
UNION ALL
SELECT 'FILTERED CTAS',COUNT(*),SUM(AMOUNT) FROM ORDERS_EAST_CTAS;
SHOW GRANTS ON TABLE ORDERS_QA;

What to expect and why

The clone contains all four orders; the filtered CTAS contains two east orders totaling 250. Equal row content would not imply equal storage construction.

Expected result for the supplied input (not live output)
OBJECT_KINDNTOTAL
CLONE4500.00
FILTERED CTAS2250.00

Choose container scope with a tiny source

Definition: A small dedicated source avoids cloning an entire shared learning database.

When to use: Optional schema/database creation privileges are required.

SQL · example
CREATE DATABASE M14_CONTAINER_SOURCE DATA_RETENTION_TIME_IN_DAYS=1;
CREATE SCHEMA M14_CONTAINER_SOURCE.SALES;
CREATE TABLE M14_CONTAINER_SOURCE.SALES.ORDERS
 CLONE L2_OBJECTS_LAB.M14_LAB.ORDERS;
CREATE SCHEMA L2_OBJECTS_LAB.M14_SCHEMA_COPY CLONE M14_CONTAINER_SOURCE.SALES;
CREATE DATABASE M14_DATABASE_COPY CLONE M14_CONTAINER_SOURCE;
SELECT COUNT(*) FROM L2_OBJECTS_LAB.M14_SCHEMA_COPY.ORDERS;
SELECT COUNT(*) FROM M14_DATABASE_COPY.SALES.ORDERS;
USE SCHEMA L2_OBJECTS_LAB.M14_LAB;

What to expect and why

Both copied ORDERS tables contain four rows. No background workload is enabled. Inspect the object inventory and grants; cleanup instructions at the end of the module include these optional names.

Check your understanding

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

If the source receives a new order tomorrow, does yesterday’s clone automatically receive it?

Try it yourself

QA needs only anonymized regional totals. Would cloning all raw orders be the best default?

Compare your reasoning

No. Prefer an approved transformed result or fixture with minimum necessary data. CLONE is valuable for snapshot fidelity, but does not itself reduce exposure or transform values.

Key takeaway

Clone only what the investigation needs and review access before granting QA users permission.

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