6: Cost & Performance Optimisation

    Unity Catalog Managed Tables Reduce Operations Overhead and Maintenance Burden

    How it works

    Unity Catalog managed tables are the default storage shape for any new Delta table created without an explicit LOCATION clause inside a Unity Catalog schema.

    The schema is bound to a managed storage location at the catalog or schema level, and any managed table created within that schema writes its underlying Delta files into a subdirectory of that location that the platform owns end to end.

    The engineer never sees the cloud object storage path, never chooses the file prefix, and never has to keep an external Hive Metastore entry in sync with the actual data files.

    When the table is dropped, the data is removed; when the table is renamed, the metadata pointer is updated and the engineer does not have to shuffle objects between buckets.

    This ownership boundary is what removes the work, and the operational savings compound across every table in the catalog.

    The first axis of saved work is automatic maintenance. Managed tables in Unity Catalog are subject to predictive optimization, which is the platform-managed background service that issues OPTIMIZE, VACUUM, and analytics-statistics jobs on the table when the workload pattern indicates they will pay off.

    The service watches read and write activity, computes the expected benefit of compaction or vacuum given the current file distribution, and runs the maintenance against a serverless compute pool that is billed under the JOBS_SERVERLESS SKU.

    The engineer does not schedule a Lakeflow Job that fires OPTIMIZE every night, does not maintain a cluster pool to drain the work, and does not have to argue with a partner team about whose budget pays for the maintenance window.

    External tables and Hive Metastore tables do not get this treatment: the team that owns the table also owns the cron schedule, the cluster sizing, and the failure pages.

    The second axis is statistics collection. Every Delta table relies on per-file statistics (min, max, null count) for the first 32 columns by default to power data skipping.

    On a managed table, write-path statistics are collected with no additional configuration, and predictive optimization triggers ANALYZE TABLE ... COMPUTE STATISTICS FOR ALL COLUMNS against the catalog when the cost-based optimizer would benefit from refreshed column-level cardinality and histogram data.

    On an external table, the same coverage exists at write time, but rebuilding the analytics statistics after a backfill or after a wide structural change is the engineer's responsibility, which in practice means a manual ANALYZE invocation tucked into a Lakeflow Job.

    The third axis is governance and lineage. The managed-storage boundary lets Unity Catalog enforce that every read and write of the table goes through the metastore, which is what makes column-level lineage, audit, and the system.access.audit actions reliable.

    External tables can be written to by any principal with WRITE FILES on the underlying cloud path, which means a side-channel write can mutate the data without the metastore observing it; the catalog cannot then guarantee that audit logs reflect every change.

    Managed tables close that gap by construction, which is the actual reason the security review board prefers them. The fourth axis is cost transparency.

    • Predictive optimization billing for a managed table lands in system.billing.usage with usage_metadata that identifies the managed table being maintained, the SKU it ran against, and the DBU consumption.
    • That makes it possible to allocate maintenance cost back to the workload that produced the table without an out-of-band tagging scheme.
    • With external tables, the engineer is running their own job to do the same work, which means the cost shows up under the cluster that ran the job, with no provenance back to the table.

    Declaring and Inspecting a Managed Table

    USE CATALOG analytics;
    USE SCHEMA gold;
    
    CREATE TABLE customer_360 (
     customer_id BIGINT,
     email_hash STRING,
     signup_date DATE,
     lifetime_value_usd DECIMAL(18, 2),
     region STRING,
     last_event_ts TIMESTAMP
    )
    CLUSTER BY (region, signup_date)
    TBLPROPERTIES (
     'delta.enableDeletionVectors' = 'true',
     'delta.enableChangeDataFeed' = 'true'
    );
    
    DESCRIBE EXTENDED analytics.gold.customer_360;
    

    The DESCRIBE EXTENDED output reports Type: MANAGED and a Location under the catalog-or-schema managed storage path. The engineer never set that path. The fact that the table is MANAGED is what activates the platform-side optimization and lifecycle behaviour.

    Predictive Optimization Configuration

    Predictive optimization is enabled at the account or workspace level for new managed tables. The toggle is at the catalog and schema scope, and the per-table override lets the team opt a specific high-throughput table out while keeping the rest of the schema on the managed schedule.

    ALTER CATALOG analytics
     SET PREDICTIVE OPTIMIZATION = ENABLED;
    
    ALTER SCHEMA analytics.gold
     SET PREDICTIVE OPTIMIZATION = ENABLED;
    
    ALTER TABLE analytics.gold.customer_360
     SET PREDICTIVE OPTIMIZATION = INHERIT;
    
    SELECT *
    FROM system.storage.predictive_optimization_operations_history
    WHERE table_full_name = 'analytics.gold.customer_360'
    ORDER BY operation_start_time DESC
    LIMIT 50;
    

    The operations history table is the audit trail for what the service has actually run, including the file count rewritten, the bytes saved by vacuum, and whether the operation succeeded. Joining this view against system.billing.usage gives a per-operation DBU figure that the team can use to justify the maintenance budget.

    When a Managed Table Is Not the Right Answer

    Managed tables are the default, but external tables remain the right answer in a small number of scenarios.

    The most common is when the data files are produced by an external system that also reads them, and the team needs to keep the cloud path as the source of truth:

    • a non-Databricks Spark cluster writing Parquet into a shared landing zone,
    • a partner tenant whose own pipelines mutate the path,
    • a regulatory regime that pins the storage account to a specific subscription that the Unity Catalog managed storage does not span.

    In every other case, the maintenance and audit savings of managed tables outweigh the loss of direct path control.

    💡 Exam Trap: A scenario describes a team that wants OPTIMIZE and VACUUM to run on a nightly cadence against a Delta table without managing the schedule. The correct answer is to convert the table to a Unity Catalog managed table and enable predictive optimization at the schema scope, not to add a Lakeflow Job that fires the maintenance statements manually. The Lakeflow Job answer works but does not match the documented platform recommendation, which is what the exam scores.

    💡 Exam Trap: DROP TABLE on a Unity Catalog managed table removes the underlying data files. There is a soft-delete window during which the table can be undropped through UNDROP TABLE, but the engineer cannot count on it past the documented retention. Distractors that claim a managed-table DROP only removes the metastore entry are describing the external-table behaviour and are wrong.

    ⚠️ Anti-Pattern: Creating an external table inside a Unity Catalog schema purely to keep a familiar cloud-storage prefix, and then scheduling a custom OPTIMIZE-plus-VACUUM Lakeflow Job to replicate predictive optimization. The team pays for both the maintenance cluster and the engineering work, gives up reliable audit guarantees, and gains nothing the managed-table form did not already provide. The decision should be made on data-ownership grounds, not path-familiarity grounds.

    📊 Limit: Predictive optimization writes its operation history to system.storage.predictive_optimization_operations_history, with rows retained for the documented system-tables retention window. Beyond that window, the audit trail for a single maintenance event has to be reconstructed from system.billing.usage and the table's Delta transaction log.

    🎯 Scenario: A platform team is migrating 800 Hive Metastore tables into Unity Catalog. Half are append-only ingestion sinks under heavy daily write load; half are dimension tables that change weekly. The team is debating whether to recreate them as managed or external. The right reading is to recreate every table that does not have a hard external-system dependency as managed, enable predictive optimization at the catalog scope, and reserve external-table treatment only for the small subset of tables that share the underlying path with non-Databricks producers. The savings come from removing 800 nightly OPTIMIZE cron entries from the orchestration surface, not from any per-query performance change.

    Decision Anchor. Choose a Unity Catalog managed table when the team owns the data end to end and wants predictive optimization, automatic statistics, and reliable audit. Choose an external table only when the underlying cloud path must be the source of truth for systems outside Databricks, when a regulatory regime pins the storage account, or when the table's lifecycle is driven by a non-Databricks producer.

    Capacity Numbers and Sizing Defaults Worth Remembering

    The managed-storage path supports the same volume limits as the underlying cloud object store; Unity Catalog adds no artificial cap.

    Predictive optimization runs against serverless compute and is billed under the documented JOBS_SERVERLESS SKU; the engineer does not pre-size a cluster.

    The first 32 columns of a managed Delta table carry collected statistics by default, which controls how data skipping behaves and is covered in detail in the next section.

    The delta.dataSkippingNumIndexedCols table property is the override knob when the working set's filter columns are not the first 32.


    Continue with the interactive course

    Track your progress, jump into practice questions and use the Shark AI tutor inside the Databricks - Data Engineer Professional learning hub.