In this blog, you will gain a comprehensive understanding of Zero Copy Cloning 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 objects in Snowflake
Lets understand with an example:
Add a new SQL Worksheet and execute the following SQL statement to clone the database.
Create database DEVDB_Clone Clone DEVDB;
DEVDB_Clone is the cloned database name, and
DEVDB is the original database name, as shown in the image below.
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.
Use Database DEVDB; Create schema Public_Clone Clone Public;
Cloning Historical Objects with Time Travel
Thank you for reading this post, and I hope you enjoyed it!