Bird
Raised Fist0
SnowflakeComparisonBeginner · 3 min read

Cloning vs Copy in Snowflake: Key Differences and Usage

In Snowflake, cloning creates a zero-copy snapshot of a database, schema, or table instantly without duplicating data, while copy physically duplicates data by loading or inserting it into a new table. Cloning is faster and more storage-efficient, whereas copying is a full data duplication process.
⚖️

Quick Comparison

Here is a quick side-by-side comparison of cloning and copy in Snowflake.

FactorCloningCopy
Data DuplicationNo physical data duplication (zero-copy)Physical data duplication
SpeedInstant creationDepends on data size and load speed
Storage UsageMinimal additional storage initiallyFull storage for duplicated data
Use CaseCreate snapshots or test environmentsCreate independent data copies
Data ConsistencyShares underlying data until changesIndependent data after copy
CostLower due to no extra storage initiallyHigher due to full data duplication
⚖️

Key Differences

Cloning in Snowflake creates a snapshot of a database, schema, or table at a specific point in time without copying the actual data. It uses metadata pointers to reference the original data, so it is very fast and storage-efficient. Changes made to the clone or original after cloning do not affect each other, but they share the same underlying data until modified.

On the other hand, copy means physically duplicating data by loading or inserting it into a new table. This process takes longer and uses more storage because it creates a full independent copy of the data. Copying is useful when you need a completely separate dataset that does not depend on the original.

In summary, cloning is best for quick snapshots and testing without extra storage cost, while copying is for creating fully independent data sets.

⚖️

Code Comparison

Here is how you create a clone of a table in Snowflake.

sql
CREATE OR REPLACE TABLE original_table (id INT, name STRING);
INSERT INTO original_table VALUES (1, 'Alice'), (2, 'Bob');

CREATE TABLE cloned_table CLONE original_table;

SELECT * FROM cloned_table;
Output
ID | NAME ---|------- 1 | Alice 2 | Bob
↔️

Copy Equivalent

Here is how you copy data by duplicating a table's contents in Snowflake.

sql
CREATE OR REPLACE TABLE original_table (id INT, name STRING);
INSERT INTO original_table VALUES (1, 'Alice'), (2, 'Bob');

CREATE TABLE copied_table AS SELECT * FROM original_table;

SELECT * FROM copied_table;
Output
ID | NAME ---|------- 1 | Alice 2 | Bob
🎯

When to Use Which

Choose cloning when you want a fast, storage-efficient snapshot of your data for testing, development, or backup without duplicating data physically. It is ideal for creating temporary environments or versioning data.

Choose copy when you need a fully independent duplicate of your data that will not be affected by changes to the original. This is useful for data migration, archiving, or when you want to modify the copy without impacting the source.

✅

Key Takeaways

Cloning creates instant, zero-copy snapshots sharing underlying data until changed.
Copy physically duplicates data, using more time and storage.
Use cloning for fast, cost-effective snapshots and testing.
Use copy for fully independent data copies needing isolation.
Cloning reduces storage costs and speeds up environment setup.