Databricks

Delta Clone Deep Dive: Cloning Tables Safely and Fast with DEEP/SHALLOW

2026-03-26
更新: 2026-03-27
NicheeLab Editorial Team

"I want to try new ETL logic against production data without polluting production." "Copying a huge table takes forever." Delta Clone solves both of these problems. DEEP CLONE produces a fully independent copy of the data, while SHALLOW CLONE shares the underlying data files with the source and creates the clone almost instantly.

This article walks through the differences between DEEP and SHALLOW CLONE, their syntax, how to choose between them by use case, how they interact with VACUUM, Time Travel, and metadata, and the points most likely to appear on the exam.

DEEP CLONE vs SHALLOW CLONE

DimensionDEEP CLONESHALLOW CLONE
Data copyPhysically copies every data fileReferences data files only (no copy)
Creation speedProportional to data size (slow on large tables)Fast — only metadata is copied
Storage costRoughly equal to the sourceNear zero (only writes to the clone consume storage)
Independence from sourceFully independent (unaffected by changes or deletes on the source)Depends on the source (can break when the source runs VACUUM)
MetadataSchema, constraints, and properties fully copiedSchema, constraints, and properties fully copied
VACUUM impactNoneBreaks if VACUUM on the source deletes referenced files
Time TravelClone gets its own history starting at version 0Clone gets its own history starting at version 0

CREATE TABLE ... CLONE Syntax

-- DEEP CLONE: データの完全コピー
CREATE TABLE dev.sandbox.orders_clone
DEEP CLONE prod.silver.orders;

-- SHALLOW CLONE: メタデータのみコピー(データは参照)
CREATE TABLE dev.sandbox.orders_shallow
SHALLOW CLONE prod.silver.orders;

-- 特定バージョンのクローン(Time Travel)
CREATE TABLE dev.sandbox.orders_v5
DEEP CLONE prod.silver.orders VERSION AS OF 5;

-- 特定タイムスタンプのクローン
CREATE TABLE dev.sandbox.orders_snapshot
SHALLOW CLONE prod.silver.orders TIMESTAMP AS OF '2026-03-25';

-- 既存テーブルの差分更新(増分DEEP CLONE)
CREATE OR REPLACE TABLE dev.sandbox.orders_clone
DEEP CLONE prod.silver.orders;

Re-running a DEEP CLONE with CREATE OR REPLACE only copies the delta since the previous clone. This is called an incremental clone, and it works well as a daily sync pattern.

Use case 1: Experimentation and dev environments

When a data scientist wants to try a new model against production data, SHALLOW CLONE is the best fit. Even a multi-terabyte table can be cloned in seconds, freeing you to experiment with joins and filters. Writes to the clone do not touch the source.

-- 実験用にSHALLOW CLONEを作成
CREATE TABLE dev.ml_experiments.user_features
SHALLOW CLONE prod.gold.user_features;

-- クローン上で自由に実験(ソースに影響なし)
ALTER TABLE dev.ml_experiments.user_features
ADD COLUMN age_bucket STRING;

UPDATE dev.ml_experiments.user_features
SET age_bucket = CASE
  WHEN age < 25 THEN 'young'
  WHEN age < 50 THEN 'middle'
  ELSE 'senior'
END;

Use case 2: ETL testing

When you test changes to ETL logic, create a full copy of the production table with DEEP CLONE and run the entire pipeline against it in your test environment. Because a DEEP CLONE is fully independent of the source, running VACUUM during the test or hitting a pipeline failure has no effect on production.

-- テスト用にDEEP CLONEを作成
CREATE TABLE staging.test.orders
DEEP CLONE prod.silver.orders;

CREATE TABLE staging.test.customers
DEEP CLONE prod.silver.customers;

-- テスト環境でETLパイプラインを実行
-- 結果が期待通りか検証後、本番に適用

Use case 3: Data archiving

When compliance requires long-term snapshots of your data, DEEP CLONE is the right tool. The archive holds a specific point in time and is unaffected by VACUUM or schema changes on the source table.

-- 月次のアーカイブスナップショット
CREATE TABLE archive.monthly.orders_202603
DEEP CLONE prod.silver.orders
  TIMESTAMP AS OF '2026-03-31 23:59:59';

Metadata replicated by a clone

  • Schema (column names and data types)
  • NOT NULL constraints
  • CHECK constraints
  • Table properties (e.g. delta.enableChangeDataFeed)
  • Partition information
  • Column and table comments

Not cloned: table change history, streaming checkpoints, and Unity Catalog grants (the clone inherits the default permissions of its destination).

Interaction with VACUUM

The biggest risk with SHALLOW CLONE is VACUUM on the source. Once VACUUM deletes data files older than the retention period, any query against a SHALLOW CLONE that still references those files will fail.

-- ソースのVACUUM保持期間を確認
DESCRIBE DETAIL prod.silver.orders;
-- delta.deletedFileRetentionDuration を確認

-- SHALLOW CLONEを安全に使う場合の推奨設定
ALTER TABLE prod.silver.orders
SET TBLPROPERTIES (
  'delta.deletedFileRetentionDuration' = 'interval 30 days'
);

What the exam tests

  • The difference between DEEP CLONE and SHALLOW CLONE (whether data is copied, dependence on the source)
  • That a SHALLOW CLONE is affected by VACUUM on the source table
  • Time Travel options on clones (VERSION AS OF / TIMESTAMP AS OF)
  • Incremental DEEP CLONE via CREATE OR REPLACE
  • That metadata (constraints and properties) is cloned
  • Picking the right clone type for the use case (experiments → SHALLOW, archives → DEEP)

Check your understanding

Data Engineer Associate / Professional

問題 1

A data engineer wants to test new ETL transformation logic against a copy of a 5 TB production table. The test will run for one week, after which the clone will be deleted. The production table runs VACUUM daily with a 7-day retention period. Which approach is most appropriate?

  1. Create the test table with DEEP CLONE
  2. Create the test table with SHALLOW CLONE
  3. Create the test table with CTAS (CREATE TABLE AS SELECT)
  4. Add test columns directly to the production table

正解: A

With daily VACUUM at 7-day retention, a SHALLOW CLONE used for a week is at real risk of failing as referenced files get deleted. DEEP CLONE copies the data fully and is unaffected by source-side VACUUM. CTAS would also work, but it loses constraints and table properties, making it weaker than DEEP CLONE. Modifying the production table directly is out of the question.

Frequently Asked Questions

What happens if VACUUM runs on the source table behind a SHALLOW CLONE?

Because a SHALLOW CLONE only references the source table's data files, queries against the clone will fail once VACUUM deletes the old files from the source. When you rely on a SHALLOW CLONE, either set the source's VACUUM retention period longer than the clone's lifetime, or convert the clone into a DEEP CLONE.

What is the difference between DEEP CLONE and CTAS (CREATE TABLE AS SELECT)?

DEEP CLONE copies the data files and also fully replicates table metadata (schema, constraints, table properties, partition information). CTAS only writes the SELECT result into a new table — NOT NULL constraints, CHECK constraints, and table properties are not carried over. If you need to preserve constraints and properties, DEEP CLONE is the right choice.

What happens when you write data into a SHALLOW CLONE?

Writes to a SHALLOW CLONE (INSERT/UPDATE/DELETE) are stored as data files that belong to the clone, with no impact on the source table. In effect, the clone gradually accumulates its own data and partially behaves like a DEEP CLONE. However, the portion of files still referenced from the source remains exposed to source-side VACUUM.

Check what you learned with practice questions

Practice with certification-focused question sets

無料で問題を解いてみる
Author

NicheeLab Editorial Team

NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.


Related articles
Databricks

Databricks Certifications: All 7 Exams, Difficulty & Study Plan (2026)

Complete guide to all 7 Databricks certifications — Data Eng...

Databricks

Databricks Exam Difficulty Ranking: All 7 Certs Compared (2026)

Every Databricks certification ranked by difficulty, with st...

Databricks

Databricks Study Guide: Fastest Pass Route & Time Estimates (2026)

How to pass Databricks certifications efficiently. Official ...

Databricks

Databricks Data Engineer Associate: Complete Guide (2026)

Domain-by-domain breakdown of the Databricks Certified Data ...

Databricks

Databricks Data Engineer Professional: Complete Guide (2026)

Tactics for the Databricks Certified Data Engineer Professio...

Browse all Databricks articles (110)
© 2026 NicheeLab All rights reserved.