Managed and external tables

kept in this browser

In a managed table Unity Catalog governs both metadata and files and deletes them on DROP; in an external table it governs only the metadata, and the files stay in the path you specified with LOCATION.

Checked against the Databricks documentation on · revised · history

On the preview radar: Configurable recovery period for dropped tables

On this page9

What it is

A table in Unity Catalog has two components: the metadata (name, schema, permissions, statistics) and the files in object storage. The distinction between managed and external is about who controls the files.

ManagedExternal
MetadataUnity CatalogUnity Catalog
Data filesUnity Catalog, in the managed location of the schema/catalog/metastoreyou, in the path chosen with LOCATION inside an external location
DROP TABLEmetadata and files deleted (files after the retention window)metadata only, the files remain
FormatsDelta and IcebergDelta, Parquet, CSV, JSON, Avro, ORC, TEXT
Automatic optimizationspredictive optimization, automatic liquid clusteringno
Direct file access from external clientsthrough the Unity Catalog APIsyes, but without permission enforcement

Why it exists

Managed is the default and the recommended choice: it costs less in storage and query time, optimizes itself, and can be recovered if dropped by mistake. External serves two concrete cases: registering data that already exists in a format Unity Catalog cannot manage (JSON, Avro, Parquet written by other systems) and letting other systems read the files directly from the bucket.

How it works

Creating

Without LOCATION the table is managed. The files land in the most specific managed location available: the schema’s, otherwise the catalog’s, otherwise the metastore root.

CREATE TABLE prod.sales.orders (
  id BIGINT, amount DECIMAL(10,2), order_date DATE
);
df.write.saveAsTable("prod.sales.orders")

With LOCATION the table is external. The path must sit inside an external location on which you have CREATE EXTERNAL TABLE, in addition to USE CATALOG, USE SCHEMA, and CREATE TABLE on the levels above.

CREATE TABLE prod.sales.orders_ext (
  id BIGINT, amount DECIMAL(10,2), order_date DATE
)
LOCATION 's3://acme-prod-data/sales/orders/';
(df.write
   .option("path", "s3://acme-prod-data/sales/orders/")
   .saveAsTable("prod.sales.orders_ext"))

To find out which type a table is: DESCRIBE EXTENDED prod.sales.orders shows Type: MANAGED or EXTERNAL along with the Location.

Modifying

ALTER TABLE works the same on both types: renaming, adding columns, changing properties, transferring ownership with ALTER TABLE t OWNER TO principal. Delta writes (INSERT, MERGE, UPDATE) are identical. The difference is that on an external table other systems can write files “from the outside”: Unity Catalog does not notice, and for non-Delta formats you need MSCK REPAIR TABLE to realign the partitions.

Dropping

DROP TABLE prod.sales.orders;      -- managed: files deleted after the retention window
DROP TABLE prod.sales.orders_ext;  -- external: the files stay in the bucket

For a managed table, recovery is possible until the retention expires (default 7 days, configurable with ALTER CATALOG prod RETAIN DROPPED TO 30 DAYS or at the schema level):

UNDROP TABLE prod.sales.orders;

For an external table there is nothing to recover: you recreate the metadata with the same CREATE TABLE ... LOCATION, and the files are still there.

Converting

An external Delta table can be converted to managed without rewriting the code that uses it:

ALTER TABLE prod.sales.orders_ext SET MANAGED;

The files are copied into the managed location in two phases: an initial copy without stopping the loads, then a short switch (a few minutes) during which writes pause and the metadata changes. You need to be the owner, the format must be Delta, and you need Databricks Runtime 17.3 LTS or serverless. If the table has Iceberg reads enabled, add TRUNCATE UNIFORM HISTORY.

Within 14 days you can roll back:

ALTER TABLE prod.sales.orders_ext UNSET MANAGED;

SET EXTERNAL exists but serves a different purpose: it converts a foreign table (Lakehouse Federation) into an external one; SET MANAGED { MOVE | COPY } does the same toward managed. It is not the way to make a native managed table external: for that you use UNSET MANAGED within the rollback window, otherwise CREATE TABLE ... LOCATION AS SELECT.

Example

A vendor drops Parquet files in s3://acme-landing/fornitore-a/. You want to query them today and bring them under control tomorrow:

CREATE TABLE prod.bronze.fornitore_a
USING PARQUET
LOCATION 's3://acme-landing/fornitore-a/';

-- once the data is stable: materialize as managed Delta
CREATE TABLE prod.silver.fornitore_a AS
SELECT * FROM prod.bronze.fornitore_a;

You do not use SET MANAGED here because the source is Parquet, not Delta.

Common mistakes

  • Running DROP TABLE on a managed table assuming the files stay: they stay only for the UNDROP window.
  • Running DROP TABLE on an external table to “free up space”: the files are still there and you keep paying for them.
  • Creating two external tables on the same path: writes from one corrupt the other.
  • Reading an external table by path (spark.read.load("s3://...")) and expecting Unity Catalog permissions to apply: only the privileges on the external location apply.
  • Trying SET MANAGED on an external Parquet table: it only works with Delta.

Exam hints

Rewritten from real exam questions: what gets asked and where people slip.

  • The exam checks whether you know who owns the storage for a managed table versus an external table. The trap is thinking DROP TABLE only removes the table definition. Remember: managed tables have their files governed by the platform, so dropping them removes metadata and data; external table files remain in their location.
  • The exam checks whether managed tables and external tables differ in who owns the files. The trap is assuming DROP TABLE always removes storage data. Remember: dropping a managed table removes metadata and data; dropping an external table removes the table definition but leaves files at the external location.
  • The exam checks whether you know who controls the data files for a managed table versus an external table. The trap is confusing a catalog or schema managed location with a table-level LOCATION. Remember: external tables point to an explicit storage path; managed tables inherit managed storage and Databricks manages the files.

Check yourself

3 questions on what this page says. Pick an answer, then check it.

  1. 1You run DROP TABLE on an external table hoping to free storage space. What happens?
    Show the answer

    A. The metadata is removed but the files stay in the bucket, so you keep paying for them

    For an external table Unity Catalog governs only the metadata, so dropping it leaves the files where they are. Deleting files after a retention window is what happens with a managed table.

    Read the section again
  2. 2What makes a table external when you create it?
    Show the answer

    D. Giving it a LOCATION inside an external location where you hold the CREATE EXTERNAL TABLE privilege

    Without LOCATION the table is managed. With LOCATION it is external, and the path has to sit inside an external location on which you have CREATE EXTERNAL TABLE, plus the usual privileges on the catalog and schema.

    Read the section again
  3. 3A vendor delivers Parquet files and you register them as an external table. Why does the page not use SET MANAGED to bring that table under full control?
    Show the answer

    A. SET MANAGED only works on Delta tables, so the data is materialized with CREATE TABLE AS SELECT instead

    Converting with SET MANAGED requires a Delta table, and the source here is Parquet. The page materializes it as a managed Delta table with CREATE TABLE AS SELECT.

    Read the section again

Where this sits

Resources

8All resources

Related news

Report a problem with this page
What kind of problem?

Reports about "Managed and external tables" go to the maintainer, not to a public thread.

Suggest a resource
What kind?

Nothing appears on the site automatically. A person reads every suggestion, checks the link and writes the note that goes with it.