Table of Contents
Understanding Zero Copy Cloning
Zero Copy Cloning is basically an interesting feature of Snowflake providing easier Cloning (creating copy of object with data) without actually copying the data.
Snowflake stores information of immutable micro partitions which makes reality of zero copy cloning.
Zero copy cloning actually creates a metadata like the original object and actually references the data from main object. Cloning of an object (database/table/schema/ streams/file formats etc.) are done using Cloud service layer which uses metadata information.
Important Points to remember:
- Once A clone is created, all the micro partitions are available for access without any new data copy.
- After the clone is created:
- If a micro partition is added in the original object, it is not available to clone. (As clone is just point in snapshot data reference)
- If a micro partition is deleted in the original object, it is still available in the Clone. ( This is because the partition is only marked as Deleted for original object due to immutability)
- If a new micro partition is added in the clone object, the original object will not have access to these newly created partitions maintaining original object’s data consistency.
- Named Objects and Internal stages can not be cloned.
- A clone can be cloned without any limitation.
- Cloned object does not inherit permissions but if we clone a complete database/schema, the child objects inherit the permissions. To inherit permissions, we have to use COPY GRANTS.
- Cloned table copies the clustering key, but automatic clustering is disabled by default.