cloning sf
Home » Snowflake » What is Zero copy cloning in Snowflake?

What is Zero copy cloning in Snowflake?

In this blog, you will gain a comprehensive understanding of Zero Copy Cloning in Snowflake.

Post Contents

What is Zero copy cloning in Snowflake?

Clone objects in Snowflake

What is Zero copy cloning in Snowflake?

Zero copy cloning in Snowflake is a feature that allows you to create an exact copy of a database, table, or schema without incurring any additional storage costs.

This is because the cloned object shares the underlying storage with the original object.

When you create a zero copy clone, Snowflake creates new metadata entries that point to the micro-partitions of the original source object. This means that the cloned object does not contain any physical data of its own.

Zero copy cloning is a very fast and efficient way to create copies of your data. It can be used for a variety of purposes, such as:

  • Creating backups
  • Creating development and testing environments
  • Creating sandboxes for data analysis and experimentation
  • Creating clones for data sharing and collaboration

To create a zero copy clone in Snowflake, you can use the following SQL statement:

CREATE <object_type> <object_name>
CLONE <source_object_name>

Clone objects in Snowflake

Lets understand with an example:

Add a new SQL Worksheet and execute the following SQL statement to clone the database.

Clone Database

Create database DEVDB_Clone 
Clone DEVDB;

Here, DEVDB_Clone is the cloned database name, and DEVDB is the original database name, as shown in the image below.

Zero copy clone sf

Zero copy clone sf

Now, as you can see in the screenshot below, a new cloned database has been created with all schemas, tables, and file formats.

Note: Internal named stages cannot be cloned.

Cloned DB

Cloned DB

Clone Schema

Use Database DEVDB;
Create schema Public_Clone 
Clone Public;
Clone schema in SF

Clone schema in SF

Cloning Historical Objects with Time Travel

Understand how to use cloning with Time Travel in snowflake

Thank you for reading this post, and I hope you enjoyed it!

Leave a Reply