DROP METASTORE

Drops a table from the metastore: removes its registry row and every per-table partition (`parquet_file`, `row_group`, `column_chunk`, typed stats, etc.). The underlying Delta table is not modified.

Category: metastorePrivilege: READ on the tableDeltaForge extension

Syntax

DROP METASTORE [IF EXISTS] '<zone.schema.table>'

Description

## Overview Removes a table from the metastore. The Delta table on storage is **never touched**: no Parquet files are deleted, no `_delta_log/` entries are written, no Delta protocol commits occur. Only the metastore's own per-table state is dropped. ## When to use Use DROP METASTORE when the metastore is consuming operational resources for a table that no longer benefits from being mirrored: - **The table is being retired or relocated.** No reason to keep its catalog rows around once it's no longer queried. - **The table moved to a workload where the metastore doesn't help.** For example, it was promoted from cloud object storage to local NVMe, or its file count dropped after a major OPTIMIZE that produced a few large files. The planner no longer benefits from the cache; DROP frees the metastore footprint. - **You need to disable the cached path temporarily** while debugging a metastore-side correctness issue. DROP followed by CREATE METASTORE is the cleanest reset (ALTER METASTORE ... REFRESH MODE = FULL is cheaper if the registry row should stay). - **Operational cleanup** of dropped registrations after a wholesale workspace deletion or zone migration. Do **not** use DROP as a way to refresh or repair a table; use `ALTER METASTORE ... REFRESH MODE = FULL` instead. DROP is destructive (drops every per-table partition); the FULL refresh keeps the registry row and is idempotent. ## Behavior - Drops every per-table LIST partition for the table (`parquet_file_<suffix>`, `column_chunk_<suffix>`, every `column_stat_<type>_<suffix>`, etc.). This is O(1) per partition; much cheaper than DELETE on millions of rows. - Deletes the row from `df_metastore.table_registry` and the row from `cache_state`. - Runs in one Postgres transaction. A crash leaves the metastore in either the fully-mirrored or fully-dropped state, never partial. - After DROP, queries against the table fall back to the legacy log + footer planning path (i.e. the path used before the metastore existed). ## Access Control | Privilege | Object | Notes | |-----------|--------|-------| | READ | Table | Same gating as CREATE METASTORE; the caller must have been able to mirror it in the first place. |

Parameters

NameTypeDescription
qualified_nameCanonical 3-part name of a table currently mirrored into the metastore.
IF EXISTSWhen present, silently succeed if the table is not mirrored in the metastore instead of returning `TableNotRegistered`. Use in idempotent teardown scripts.

Examples

-- Drop the metastore mirror for a table.
DROP METASTORE 'analytics.sales.orders';
-- Idempotent variant for teardown scripts.
DROP METASTORE IF EXISTS 'analytics.sales.orders';

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →