What you will be able to do
- Explain why a Unity Catalog managed table can be maintained automatically while an external table cannot, and describe what DROP and UNDROP do to a managed table
- Describe which operations Predictive Optimization runs, how it decides when to run them, what compute it uses and the 7-day VACUUM floor
- Turn Predictive Optimization on or off at the account, catalog, schema or table level, know who is allowed to, and say what happens to a table you exclude
- Explain how liquid clustering and CLUSTER BY AUTO remove partition redesign and ZORDER jobs once Predictive Optimization is running
Key concept
Unity Catalog managed table — A table where Unity Catalog governs access and also owns the data files: where they are stored, how they are optimized and when they are deleted. Because the platform owns the files, it can maintain them without a job you write.
1.Managed tables hand the file lifecycle to Unity Catalog
Automatic maintenance starts with who owns the data files. Unity Catalog governs every table you register in it: access control, auditing and lineage. For a managed table it also controls where the files live and what happens to them over time, including how they are organized, optimized and deleted. For an external table you choose the storage path, and the files belong to you or to whichever system writes them. Unity Catalog governs that table but leaves its files alone.
This split decides how much maintenance is possible. The platform cannot compact or clean up files whose location and lifecycle belong to someone else. When Unity Catalog owns them, it can. Managed tables are the default and recommended table type for Delta Lake and Apache Iceberg. Compared with external tables they cost less to store and query, and they maintain and optimize themselves. The files still sit in your own cloud account: Unity Catalog chooses a path inside the managed storage location set on the metastore, catalog or schema. External engines can still read them through open APIs such as the Unity REST API and the Iceberg REST Catalog.
| Property | Managed table | External table |
|---|---|---|
| Storage location | Set by Unity Catalog (in your cloud account) | Set by you |
| File lifecycle management | Managed by Unity Catalog (optimization, organization, deletion) | Managed by you |
| Formats | Delta or Apache Iceberg | Delta, CSV, JSON, Avro, Parquet, ORC and others |
| On DROP TABLE | Unity Catalog deletes the underlying data files | Metadata is removed; data files remain in place |
Dropping a table is part of the lifecycle too, so the two table types behave differently here. Dropping a managed table does not remove its files straight away. The table can be recovered with UNDROP TABLE during a recovery period, which is 7 days by default. You can set that period at the catalog or schema level, to 0 to turn recovery off or to anywhere from 7 to 30 days. Once the period ends, an asynchronous purge permanently deletes the data files, so nobody has to go into the bucket and clean up. Dropping an external table removes only the metadata. Its files stay in storage until you delete them yourself.
On Wednesday they are still inside the default 7-day recovery period, so UNDROP TABLE brings the table back. After three weeks the period has ended: the table cannot be recovered, and the asynchronous purge deletes its data files.
Checkpoint 1 of 8· Check yourself
A team wants to convert its Unity Catalog managed Delta tables to external tables in a bucket they control. Their reasoning is that the storage layer will then handle compaction and cleanup, so they can retire their maintenance jobs. What is wrong with this plan?
Unity Catalog can only maintain files whose location and lifecycle it owns. Making the tables external hands that lifecycle back to the team, so the platform can no longer compact or clean up the files and the maintenance work stays with them.
“External assets: Unity Catalog controls governance only. The underlying file storage lifecycle is controlled by you or an external system.”Source: docs.databricks.com
2.What Predictive Optimization runs, and when
Predictive Optimization is the feature that turns managed-table ownership into maintenance nobody has to schedule. It runs OPTIMIZE, VACUUM and ANALYZE on Unity Catalog managed tables, both Delta Lake and Iceberg. It does not run them on a timetable. It looks for tables that would benefit from an operation and queues that operation, and it collects statistics when data is written. A table nobody writes to doesn't get compacted every night just because a cron entry says so.
| Operation | What it does for the table |
|---|---|
| OPTIMIZE | Triggers incremental clustering for liquid-clustered tables and improves query performance by optimizing file sizes |
| VACUUM | Reduces storage costs by deleting data files no longer referenced by the table |
| ANALYZE | Scans the table and collects statistics to improve query performance |
Compaction is the clearest example. Rewriting many small files into fewer balanced ones is covered in Balanced file sizes through compaction (OPTIMIZE). With Predictive Optimization on a managed table, nobody has to schedule that OPTIMIZE. A team that kept nightly OPTIMIZE and VACUUM jobs for dozens of managed tables can turn Predictive Optimization on for the catalog or schema that holds them and retire the jobs. Making those tables external would remove the option altogether, because Predictive Optimization never runs on external tables or on tables loaded into a workspace as OpenSharing recipients.
These operations run on serverless compute for jobs and are billed to a serverless jobs SKU, not to your clusters or warehouses. The workspace must be on the Premium plan or above in a supported region, and you must use SQL warehouses or Databricks Runtime 12.2 LTS or above. Accounts created on or after November 11, 2024 have it enabled by default, and older accounts are being enabled in a gradual rollout.
VACUUM follows the table's delta.deletedFileRetentionDuration property, which defaults to 7 days. If you need longer time travel, set the property before you enable Predictive Optimization, so the first automatic VACUUM doesn't delete files you meant to keep. Lowering the property does not speed cleanup up: when Predictive Optimization runs VACUUM FULL it still keeps files for at least 7 days, which prevents data loss and preserves recent time travel.
ALTER TABLE table_name SET TBLPROPERTIES ('delta.deletedFileRetentionDuration' = '30 days');Checkpoint 2 of 8· Fill the gap
Before turning on Predictive Optimization for a managed table that must keep 30 days of time travel, you run this statement. Which property name goes in the blank so the automatic VACUUM keeps the files?
ALTER TABLE table_name SET TBLPROPERTIES (' ? ' = '30 days');Predictive Optimization's VACUUM uses delta.deletedFileRetentionDuration, which defaults to 7 days, to decide how long to keep unreferenced files. Setting it before you enable the feature stops the first automatic VACUUM from deleting files you meant to keep for time travel.
Source: docs.databricks.comSources4
3.Enabling it at catalog, schema or table level
Predictive Optimization uses an inheritance model, so one setting can cover hundreds of tables. Every managed table inherits the account value by default. An account admin sets that value in the accounts console under Settings, then Feature enablement. Below the account, an explicit ENABLE or DISABLE on a catalog, schema or table overrides what it inherits. Schemas in an enabled catalog inherit the setting, and so do the tables in an enabled schema. INHERIT removes an explicit setting so the object follows its parent again.
ALTER CATALOG [catalog_name] { ENABLE | DISABLE | INHERIT } PREDICTIVE OPTIMIZATION;
ALTER { SCHEMA | DATABASE } schema_name { ENABLE | DISABLE | INHERIT } PREDICTIVE OPTIMIZATION;
ALTER TABLE table_name { ENABLE | DISABLE | INHERIT } PREDICTIVE OPTIMIZATION;| Unity Catalog object | Required privilege |
|---|---|
| Account | Account admin |
| Catalog | Catalog owner, or a user with MANAGE privilege on the catalog |
| Schema | Schema owner, or a user with MANAGE privilege on the schema |
| Table | Table owner, or a user with MANAGE privilege on the table |
Excluding one table therefore doesn't need a new catalog or a support ticket. Say finance.ledger_raw is a write-heavy table in a schema that has Predictive Optimization enabled. Its owner, or anyone with MANAGE on it, runs ALTER TABLE ... DISABLE PREDICTIVE OPTIMIZATION. Every other table in the schema keeps inheriting the enabled setting. The excluded table now gets no automatic OPTIMIZE, VACUUM or ANALYZE. If it still needs compaction, cleanup or statistics, those go back to being jobs someone schedules.
Once maintenance runs on its own, you check on it instead of running it. There are four places to look:
DESCRIBE (CATALOG | SCHEMA | TABLE) EXTENDED nameshows the Predictive Optimization field, including whether the value is inherited.- On Databricks Runtime 18 LTS and above,
DESCRIBE TABLE EXTENDED ... AS JSONreturnspredictive_optimization_evaluations, which gives the latest result for COMPACTION, CLUSTERING, AUTO_CLUSTERING_COLUMN_SELECTION and VACUUM. - The Catalog Explorer History tab labels operations that ran as Auto and skipped ones as Not applied. Click a Not applied row to see why it was skipped.
- The system table
system.storage.predictive_optimization_operations_historyrecords operations, costs and impact.
Evaluation results can take up to 24 hours to appear, and skip reasons are not shown for ANALYZE.
Checkpoint 3 of 8· Check yourself
Schema sales has Predictive Optimization enabled. The team wants to take one write-heavy table, sales.events_raw, off automatic maintenance. Every other table in the schema should keep it. Which approach works?
An explicit DISABLE on the table overrides the value it inherits from the schema, and the table owner or anyone with MANAGE on it can set it. INHERIT does the opposite: it removes an explicit setting so the table follows its parent, which here is the enabled schema.
“You can explicitly enable or disable predictive optimization for a catalog, schema, or table to override this behavior.”Source: docs.databricks.com
Checkpoint 4 of 8· Exam question
A schema in Unity Catalog has predictive optimization enabled, and most of its managed tables inherit that setting. One table in the schema, finance.ledger_raw, is extremely write-heavy and the team wants to exclude only this table from automatic maintenance while every other table in the schema keeps running under predictive optimization. Which two statements about accomplishing this are correct? (Select 2)(Select 2)
Correct answers: A, B — A table owner or a user with MANAGE privilege on finance.ledger_raw can explicitly disable predictive optimization at the table level to override the schema-level setting.; Predictive optimization settings cascade from account, to catalog, to schema, to table, and a lower-level explicit setting overrides the inherited value from the level above.
- A. Predictive optimization can be enabled or disabled at the account, catalog, schema, or table level, and table owners or holders of
MANAGEprivilege on that table can set an explicit table-level value that overrides the inherited schema setting. - B. The enablement hierarchy flows downward from account through catalog and schema to table, with each level inheriting the setting above it unless explicitly overridden, which is exactly the mechanism that lets one table opt out while siblings stay enabled.
- C. Settings are scoped per object; overriding predictive optimization on one table has no effect on any other table in the schema, since each managed table can carry its own explicit setting independent of its siblings.
- D. Granularity goes down to the individual table, so moving the table to a new catalog is unnecessary; a table-level override accomplishes the same exclusion without relocating any data.
- E. A table can explicitly enable or disable predictive optimization regardless of what the schema is set to; the documented table-level override exists precisely so that a table's value can differ from the inherited schema value, which is what allows a single table to opt out.
- F. Enabling or disabling predictive optimization is a self-service setting exposed to account admins and object owners with
MANAGEprivilege through the UI, SQL, or API; it does not require opening a support ticket with Databricks.
Sources4
4.Liquid clustering and CLUSTER BY AUTO: no layout jobs
File layout is the other kind of maintenance teams used to run by hand: choosing partition columns, redesigning them when queries changed, and scheduling ZORDER jobs. Liquid Clustering replaces partitioning and ZORDER by organizing data on clustering keys. You can redefine the keys without rewriting existing data, so changing the layout no longer means rebuilding the table.
Clustering keys alone do not keep a table laid out. New data is clustered when OPTIMIZE runs, and with manual keys someone has to run those OPTIMIZE jobs. Predictive Optimization takes that over: its OPTIMIZE triggers incremental clustering on liquid-clustered tables. Adding CLUSTER BY without Predictive Optimization keeps the scheduled job, and adding both removes it.
CREATE OR REPLACE TABLE table1 (column01 int, column02 string) CLUSTER BY AUTO;CLUSTER BY AUTO also removes the work of choosing keys. It is available only on Unity Catalog managed tables (Delta on Databricks Runtime 15.4 LTS and above), and it depends on Predictive Optimization, which selects the keys and runs clustering asynchronously. Predictive Optimization does three things for these tables:
- It analyzes the table's historical query workload to find the best candidate columns.
- It selects new keys if query patterns or data distributions change, such as when new dashboards start filtering on different columns.
- It changes keys only when the predicted data-skipping savings outweigh the cost of reclustering.
Keys are not fixed by the order of columns in the DDL, and AUTO never creates partition directories.
Automatic key selection does not always pick keys. It holds off when the table is too small to benefit, when the current layout already matches the queries, when the table isn't queried often, or when you aren't on Databricks Runtime 15.4 LTS or above. In those cases an AUTO LIQUID row marked Not applied appears in the History tab. One DDL mistake turns the feature off: running CREATE OR REPLACE without CLUSTER BY AUTO disables automatic clustering and drops the columns it had chosen. A managed table that is already partitioned can move over with ALTER TABLE ... REPLACE PARTITIONED BY WITH CLUSTER BY AUTO. This starts from the current partition columns and lets Predictive Optimization adapt the keys from there.
Checkpoint 5 of 8· Fill the gap
The dashboards that query a managed Delta table keep changing which columns they filter on, and nobody wants to pick or revisit clustering keys. Which token completes this DDL so that Predictive Optimization chooses and adapts the keys?
CREATE OR REPLACE TABLE table1 (column01 int, column02 string) CLUSTER BY ? ;CLUSTER BY AUTO hands key selection to Predictive Optimization. It studies the table's query history and changes keys when query patterns change. Fixed columns would mean someone has to choose them and revisit them. NONE turns clustering off.
Source: docs.databricks.comCheckpoint 6 of 8· Check yourself
After adding CLUSTER BY (customer_id) to a managed table in a schema where Predictive Optimization is disabled, an engineer deletes the table's nightly OPTIMIZE job. What happens to the layout from then on?
Clustering keys on their own do not keep the table laid out, because new data is clustered only when OPTIMIZE runs. Without Predictive Optimization, someone still has to schedule that OPTIMIZE. CLUSTER BY AUTO depends on Predictive Optimization too, so switching to it would not help here.
“After enabling liquid clustering, run OPTIMIZE jobs to incrementally cluster data.”Source: docs.databricks.com
Checkpoint 7 of 8· Exam question
A data engineering team manages dozens of Unity Catalog managed Delta tables that previously required scheduled jobs to run OPTIMIZE and VACUUM on a nightly cron schedule. Leadership wants to retire these maintenance jobs without losing the performance and storage benefits they provide. Which change lets Databricks take over this maintenance automatically for these tables?
Correct answer: A — Enable predictive optimization at the catalog or schema level so Databricks automatically runs OPTIMIZE, VACUUM, and ANALYZE on the managed tables underneath it.
- A. Predictive optimization is the feature purpose-built for this: once enabled on a catalog, schema, or table, Databricks identifies which managed tables would benefit and automatically queues
OPTIMIZE,VACUUM, andANALYZEas serverless jobs, replacing manual cron-scheduled maintenance. - B. External tables move Databricks out of managing the underlying files, which removes the automated compaction and retention benefits entirely rather than replacing them; predictive optimization specifically requires Unity Catalog managed tables, not external ones.
- C. Write-time clustering only reorganizes newly written data above certain size thresholds; it does not perform the file compaction, stale-file removal, or statistics collection that scheduled
OPTIMIZE/VACUUM/ANALYZEjobs provide, so historical data and storage growth remain unmanaged. - D. A larger warehouse increases compute cost for every query but does nothing to compact small files, remove tombstoned files, or refresh statistics, so the underlying maintenance problem the team wants automated is left unresolved.
Checkpoint 8 of 8· Exam question
A newly created Unity Catalog managed table is defined with CREATE TABLE events (event_id STRING, event_date DATE, payload STRING) CLUSTER BY AUTO;. Query patterns against this table are expected to shift over the first few months as new dashboards are built. What behavior should the team expect from automatic liquid clustering on this table?
Correct answer: A — Databricks analyzes the historical query workload against the table and selects clustering keys itself, later choosing new keys if query patterns change and the expected performance gain outweighs the reclustering cost.
- A.
CLUSTER BY AUTOhands key selection to Databricks itself: it inspects the workload's query history to pick candidate clustering columns and later swaps in new keys only when the projected performance benefit justifies the cost of reclustering, adapting as dashboards and access patterns evolve. - B.
CLUSTER BY AUTOalready engages automatic key selection at creation time, so the table does not sit unclustered awaiting a manualALTER TABLEstatement; that command is how explicit, non-automatic clustering keys are set instead. - C. Clustering keys are not fixed by declaration order and are not permanent; automatic clustering explicitly re-evaluates and can change the chosen keys over the table's lifetime as query patterns shift, without requiring the table to be dropped and recreated.
- D. Liquid clustering organizes data files logically without creating a rigid directory structure per distinct value, which is the Hive-style partitioning behavior it is designed to replace, so it avoids the small-partition and directory-explosion problems that come with high-cardinality static partitioning.
Practise it for real
Put one schema's managed tables under Predictive Optimization, exclude one table, and confirm the settings took effect.
1.Run ALTER SCHEMA <schema_name> ENABLE PREDICTIVE OPTIMIZATION; as the schema owner or a user with MANAGE on it.
Why: Tables in an enabled schema inherit the setting, so one statement covers every managed table in it.
You should see: The statement succeeds without changing any table.
2.Run ALTER TABLE <one_table> DISABLE PREDICTIVE OPTIMIZATION; on a single table in that schema.
Why: An explicit table-level setting overrides the value inherited from the schema.
You should see: Only this table is excluded. The other tables keep inheriting the enabled setting.
3.Run DESCRIBE TABLE EXTENDED on the excluded table and on one other table in the schema.
Why: The Predictive Optimization field shows whether the setting is explicit or inherited.
You should see: The excluded table shows disabled. The other table shows enabled and indicates that the value is inherited.
4.After a day, open the History tab in Catalog Explorer for the enabled table and choose Automatic runs.
Why: This filter shows only automatic operations, such as those run by Predictive Optimization.
You should see: Rows labeled Auto for operations that ran, and Not applied rows for skipped ones. Click a Not applied row to see why it was skipped.
Stuck? Get a nudge
If you need more than 7 days of time travel on a table, set delta.deletedFileRetentionDuration before step 1.
Sources
(5)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.databricks.com/aws/en/data-governance/unity-catalog/managed-versus-externalOfficial docs
“When you drop a managed table, Unity Catalog deletes the underlying data files.”
↩︎ Managed tables hand the file lifecycle to Unity Catalog“External assets: Unity Catalog controls governance only.”
↩︎ Managed tables hand the file lifecycle to Unity Catalog“Unity Catalog controls both governance (access control, auditing, lineage) and the underlying file storage lifecycle”
↩︎ Key concept“External assets: Unity Catalog controls governance only. The underlying file storage lifecycle is controlled by you or an external system.”
↩︎ Checkpoint - 2.https://docs.databricks.com/aws/en/tables/managedOfficial docs
“managed tables cost less to store and query, maintain and optimize themselves automatically”
↩︎ Managed tables hand the file lifecycle to Unity Catalog - 3.
“Unity Catalog supports the UNDROP TABLE command to recover dropped managed tables.”
↩︎ Managed tables hand the file lifecycle to Unity Catalog“configure the recovery period at the catalog or schema level to 0 (to disable recovery) or 7 to 30 days”
↩︎ Managed tables hand the file lifecycle to Unity Catalog - 4.
“Predictive optimization automatically runs OPTIMIZE, VACUUM, and ANALYZE on Unity Catalog managed tables”
↩︎ What Predictive Optimization runs, and when“Identifies tables that would benefit from maintenance operations and queues those operations to run.”
↩︎ What Predictive Optimization runs, and when“Predictive optimization runs ANALYZE, OPTIMIZE, and VACUUM operations using serverless compute for jobs.”
↩︎ What Predictive Optimization runs, and when“Predictive optimization uses an inheritance model.”
↩︎ Enabling it at catalog, schema or table level“You can override the account default at the catalog, schema, or table level.”
↩︎ Enabling it at catalog, schema or table level“DESCRIBE TABLE EXTENDED ... AS JSON returns a predictive_optimization_evaluations field in the output.”
↩︎ Enabling it at catalog, schema or table level“Triggers incremental clustering for enabled tables.”
↩︎ Liquid clustering and CLUSTER BY AUTO: no layout jobs“Only Unity Catalog managed tables are supported.”
↩︎ Exam trap 1“predictive optimization still retains data files for a minimum of 7 days when it runs VACUUM FULL”
↩︎ Exam trap 4“You can override the account default at the catalog, schema, or table level.”
↩︎ Exam trap 5“OPTIMIZE does not run ZORDER when executed by predictive optimization. On tables that use Z-order, predictive optimization ignores Z-ordered files.”
↩︎ Prediction“Disabling predictive optimization at the account level does not disable it for catalogs or schemas that have specifically enabled it.”
↩︎ Prediction“You can explicitly enable or disable predictive optimization for a catalog, schema, or table to override this behavior.”
↩︎ Checkpoint - 5.https://docs.databricks.com/aws/en/tables/clusteringOfficial docs
“Liquid clustering is a data layout optimization technique that replaces table partitioning and ZORDER.”
↩︎ Liquid clustering and CLUSTER BY AUTO: no layout jobs“Databricks changes clustering keys only when the predicted cost savings from data skipping improvements outweigh the data clustering cost.”
↩︎ Liquid clustering and CLUSTER BY AUTO: no layout jobs“Databricks analyzes the table's historical query workload and identifies the best candidate columns for clustering.”
↩︎ Liquid clustering and CLUSTER BY AUTO: no layout jobs“After enabling liquid clustering, run OPTIMIZE jobs to incrementally cluster data.”
↩︎ Exam trap 2“Automatic liquid clustering requires predictive optimization for automatic key selection and clustering operations, and runs asynchronously.”
↩︎ Exam trap 3“After enabling liquid clustering, run OPTIMIZE jobs to incrementally cluster data.”
↩︎ Checkpoint