Type before DROP
Managed means files are marked for deletion. External means only metadata is unregistered.
See the matrix →In Unity Catalog, dropping a managed table marks its data files for deletion — dropping an external table only unregisters metadata. Know which one you're dropping, and know the UNDROP runbook before you need it.
This issue: the managed-versus-external drop matrix, a verified Unity Catalog recovery runbook, and a safety checklist that keeps cleanup automation away from managed data.
Managed means files are marked for deletion. External means only metadata is unregistered.
See the matrix →Use SHOW TABLES DROPPED, the original table_id, and UNDROP TABLE WITH ID.
Usually not yet for a Unity Catalog managed table inside its configured recovery period.
Read the answer →Last verified against official Databricks documentation: October 8, 2026. Correction history: first publication — no corrections.
On a Unity Catalog MANAGED table, DROP TABLE marks the underlying data files for deletion: the default UNDROP recovery window is 7 days, followed by an asynchronous purge. On an EXTERNAL table, it only unregisters catalog metadata — the files remain in your storage and become your cleanup problem.
Check the type before you drop with DESCRIBE EXTENDED and its Type row, or query table_type from system.information_schema.tables.
DROP in automation without a type gate, and never DROP + CREATE the same name in a pipeline. Use CREATE OR REPLACE TABLE for an atomic, history-preserving replacement.Illustrative scenario: a routine cleanup job drops a managed table assuming drop means unregister. The table vanishes from the catalog and its files are marked for deletion. An external table dropped in the same job leaves every file in place — re-registering over the same LOCATION brings all rows back; recreating the managed table brings back zero rows.
SHOW TABLES DROPPED IN <schema>; and note its table_id.UNDROP TABLE <catalog>.<schema>.<table>; recovers the most recent drop of that name. If the name is taken because you recreated it, rename or drop the imposter first, or target precisely with UNDROP TABLE WITH ID '<table_id>';PRIMARY KEY / FOREIGN KEY constraints manually — UNDROP does not restore them.CREATE SCHEMA IF NOT EXISTS drop_lab;
The managed table has no LOCATION, so Unity Catalog assigns its storage. For the external table, replace s3://<bucket-path> with a path under your registered external location.
CREATE OR REPLACE TABLE drop_lab.managed_demo (id INT, v STRING) USING DELTA;
INSERT OVERWRITE drop_lab.managed_demo VALUES (1, 'a'), (2, 'b');
CREATE OR REPLACE TABLE drop_lab.external_demo (id INT, v STRING)
USING DELTA
LOCATION 's3://<bucket-path>/drop_lab/external_demo';
INSERT OVERWRITE drop_lab.external_demo VALUES (1, 'a'), (2, 'b');
Note: INSERT OVERWRITE is safe here because each table was just created empty by CREATE OR REPLACE; it keeps the setup idempotent on rerun. See Issue 012 for why INSERT OVERWRITE without a PARTITION clause is dangerous on tables that already hold data.
Script this into every cleanup job.
SELECT table_name, table_type
FROM system.information_schema.tables
WHERE table_schema = 'drop_lab'
AND table_name IN ('managed_demo', 'external_demo');
managed_demo | MANAGED ; external_demo | EXTERNALDROP TABLE drop_lab.managed_demo;
DROP TABLE drop_lab.external_demo;
The files never moved.
CREATE TABLE drop_lab.external_demo (id INT, v STRING)
USING DELTA
LOCATION 's3://<bucket-path>/drop_lab/external_demo';
SELECT * FROM drop_lab.external_demo ORDER BY id;
(1, 'a'), (2, 'b')A new table has no link to the dropped files.
CREATE TABLE drop_lab.managed_demo (id INT, v STRING) USING DELTA;
SELECT * FROM drop_lab.managed_demo;
DROP TABLE drop_lab.managed_demo; -- remove the empty shell so the name is free
SHOW TABLES DROPPED IN drop_lab; -- note the table_id of the ORIGINAL
UNDROP TABLE WITH ID '<table_id_of_original_managed_demo>';
SELECT * FROM drop_lab.managed_demo ORDER BY id;
(1, 'a'), (2, 'b'). Privileges, column specification, and properties are restored. Recreate PRIMARY KEY / FOREIGN KEY constraints manually — UNDROP does not restore them.SELECT COUNT(*) AS managed_drops_blocked
FROM system.information_schema.tables
WHERE table_schema = 'drop_lab'
AND table_type = 'MANAGED';
The gate passes only when every table the job may drop is EXTERNAL (count = 0), or the drop list is an explicit allowlist reviewed by a human.
DESCRIBE SCHEMA EXTENDED drop_lab;
Check the Recovery Period Hours row: 0 means UNDROP is disabled for this schema.
table_type from information_schema; block MANAGED drops or require an explicit allowlist.CREATE OR REPLACE TABLE, never DROP + CREATE. It keeps identity and history, remains RESTORE-able, and is the documentation's explicit recommendation.RETAIN DROPPED TO per catalog or schema. Never treat UNDROP as backup: the window is finite, purge follows, and constraints are lost.Almost certainly not yet. The drop marks the files for deletion; you have the recovery period — 7 days by default, configurable per catalog or schema — before the asynchronous purge removes them. Run SHOW TABLES DROPPED IN <schema>, find the table_id, then UNDROP TABLE WITH ID '<id>', or UNDROP TABLE <name> if nothing reclaimed the name.
Verify the rows and recreate PRIMARY KEY / FOREIGN KEY constraints manually. UNDROP restores privileges, column specification, and properties, but not constraints. Then fix the real bug: put a table_type gate in front of every automated DROP.
No. External tables need a registered external location plus the CREATE EXTERNAL TABLE privilege, and every external drop leaves orphaned files that you must clean up — orphaned data is its own governance problem. Databricks recommends managed as the default for automatic optimization, lower cost, and the UNDROP safety net. The right control is gating DROPs, not avoiding managed tables.
No — UNDROP is a Unity Catalog feature. On the Hive metastore, dropping a managed table deletes the data immediately. That is another reason to finish the Unity Catalog migration for anything you care about.
DROP TABLE — gate it on table_type first.SHOW TABLES DROPPED, then UNDROP.RETAIN DROPPED deliberately; 0 disables recovery.0, the asynchronous purge follows, and constraints are lost.CREATE OR REPLACE TABLE; the drop/recreate pattern disrupts concurrent readers.CREATE EXTERNAL TABLE privilege for the external half; the managed half runs anywhere on Unity Catalog.Strengthen the Databricks fundamentals behind Unity Catalog tables, safe data operations, and production recovery.
Practice the platform basics behind managed tables, external locations, data pipelines, and production operations.
Browse DataCamp Databricks courses →Partner links: we may earn a commission if you enroll through these recommendations, at no extra cost to you.
CREATE OR REPLACE TABLE semantics for identity, history, RESTORE, and atomicity.SHOW TABLES DROPPED, the WITH ID form, name-conflict handling, restored metadata versus PK/FK constraints, parent schema/catalog requirements, and the external-table permission note.RETAIN DROPPED TO.CREATE EXTERNAL TABLE prerequisites; and managed tables as the recommended default.UNDROP TABLE WITH ID when names clash, and notes the 7-day window and external-table permission requirement.