CertSafari
    Databricks Certified Data Engineer Professional - October 9 onwards· Lessons

    Domain 5 · Lesson 27/45

    Managed tables and Predictive Optimization: automatic Delta maintenance in Unity Catalog

    Explain how Unity Catalog managed tables, Predictive Optimization, and Liquid Clustering reduce operational and maintenance overhead for a given workload.

    17 min read
    2.5% of exam
    5 sources
    Published 22 Oct 2026
    Docs as of 30 Sep 2026

    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.

    Managed versus external tables in Unity Catalog
    PropertyManaged tableExternal table
    Storage locationSet by Unity Catalog (in your cloud account)Set by you
    File lifecycle managementManaged by Unity Catalog (optimization, organization, deletion)Managed by you
    FormatsDelta or Apache IcebergDelta, CSV, JSON, Avro, Parquet, ORC and others
    On DROP TABLEUnity Catalog deletes the underlying data filesMetadata 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.

    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?

    Sources123

    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.

    The three operations Predictive Optimization runs on managed tables
    OperationWhat it does for the table
    OPTIMIZETriggers incremental clustering for liquid-clustered tables and improves query performance by optimizing file sizes
    VACUUMReduces storage costs by deleting data files no longer referenced by the table
    ANALYZEScans 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.

    Extend the VACUUM retention window before enabling Predictive Optimizationsql
    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');

    Sources4

    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.

    Enable, disable, or reset Predictive Optimization at each levelsql
    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;
    Who may change the Predictive Optimization setting at each level
    Unity Catalog objectRequired privilege
    AccountAccount admin
    CatalogCatalog owner, or a user with MANAGE privilege on the catalog
    SchemaSchema owner, or a user with MANAGE privilege on the schema
    TableTable 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 name shows the Predictive Optimization field, including whether the value is inherited.
    • On Databricks Runtime 18 LTS and above, DESCRIBE TABLE EXTENDED ... AS JSON returns predictive_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_history records 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?

    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)

    0 of 2 selected

    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 a table whose clustering keys Databricks choosessql
    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  ? ;

    Checkpoint 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?

    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?

    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?

    Sources54

    Practise it for real

    Put one schema's managed tables under Predictive Optimization, exclude one table, and confirm the settings took effect.

    1. 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. 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. 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. 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. 1.
      “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. 2.
      “managed tables cost less to store and query, maintain and optimize themselves automatically”
      ↩︎ Managed tables hand the file lifecycle to Unity Catalog
    3. 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. 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. 5.
      “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

    Spotted a mistake, or was something unclear? Tell us.