Crosshire
← Databricks Audit
— Crosshire / Learn · Tech · Databricks · Audit

Storage & Optimization

What Predictive Optimization is doing to your Delta tables and what it costs. Clustering / compaction / VACUUM history, table inventory, time-travel retention and Iceberg / UniForm metadata.

9 queriesbuilt on system.*

System tables used

system.storage.predictive_optimization_operations_history

The audit log of every maintenance operation that Predictive Optimization (and automatic/liquid clustering) performed on your Unity Catalog managed tables — OPTIMIZE/compaction, liquid CLUSTERING, VACUUM, and data-skipping/clustering column-selection decisions — each stamped with an estimated DBU cost.

  • Grain: one row per maintenance operation on a table (identified by table_id), of a given operation_type, at a given start_time/end_time. The queries here aggregate that grain up to per-table / per-op-type / per-status.
  • Key columns:
    • account_id, workspace_id, metastore_name, catalog_name, schema_name, table_name, table_id — where the table lives; table_id is the stable identity (name can be reused/renamed).
    • operation_type — the maintenance kind: CLUSTERING, VACUUM, AUTO_CLUSTERING_COLUMN_SELECTION, DATA_SKIPPING_COLUMN_SELECTION (and OPTIMIZE/compaction). Each type populates a different set of keys in operation_metrics.
    • operation_status — outcome; observed enum is SUCCESSFUL or 'FAILED: INTERNAL_ERROR' (note the embedded colon). Drives per-table success-rate / failing-table findings.
    • operation_metricsmap<string,string> of per-op counters; must be cast for numeric use. Documented keys by type: CLUSTERING → number_of_removed_files, number_of_clustered_files, amount_of_data_removed_bytes, amount_of_clustered_data_bytes; VACUUM → number_of_deleted_files, amount_of_data_deleted_bytes; AUTO_CLUSTERING_COLUMN_SELECTION → has_column_selection_changed, old_clustering_columns, new_clustering_columns, additional_reason (all categorical strings; old_clustering_columns = 'None' when previously unpartitioned); DATA_SKIPPING_COLUMN_SELECTION → added_/removed_/new_data_skipping_columns (string lists), amount_of_scanned_bytes, number_of_scanned_files (+ an old_data_skipping_columns key not selected here).
    • usage_quantity + usage_unit — the ESTIMATED_DBU consumed by the op (SUM only; it is an estimate, not the billed line). Value may lag the operation row up to ~24h as billing populates, so the most recent day is provisional.
    • start_time, end_time — op window; used for the 30-day filter and for MIN/MAX first/last-op times.
  • Availability: Public Preview. Requires Unity Catalog and that Predictive Optimization is enabled for the metastore/tables (Enterprise-tier feature); only managed UC tables are PO-eligible, so external tables never appear. Regional (not in every cloud region) with ~180-day retention. Reader needs SELECT on system.storage. If PO is off or nothing ran in-window, the query returns zero rows (valid, not an error); if the schema isn't enabled you may get TABLE_OR_VIEW_NOT_FOUND.

system.information_schema.tables

The Unity Catalog catalog-of-tables view — the inventory of every table/view the querying principal can see.

  • Grain: one row per table or view in Unity Catalog. The query aggregates to a count per catalog/schema/type/format.
  • Key columns:
    • table_typeMANAGED, EXTERNAL, or VIEW (doc-confirmed). EXTERNAL = not PO-eligible, so this bounds the PO coverage gap.
    • table_catalog, table_schema — location (plausible information_schema names; unverified in this repo's doc audit).
    • data_source_format — e.g. DELTA / ICEBERG, used to flag Iceberg/UniForm candidates (unverified name/presence).
    • COUNT(*) as table_count — inventory size per group.
  • Availability: Part of standard SQL information_schema under Unity Catalog (per-catalog view exposed under system.information_schema for the metastore). Privilege-aware — a principal sees only tables it has privileges on, so counts reflect the collector's grants, not necessarily the whole metastore. Carries no size columns (size requires the ANALYZE probe below). Requires UC; empty/partial if the principal lacks broad grants.

> Note: system.storage.table_metrics_history is a primary table of this domain but is not referenced by any query in this folder — physical/size metrics here come from the on-demand ANALYZE probe instead (see Notes).

## Non-system-table probes (per-table, run on a warehouse)

These are not system tables — they are on-demand statements the collection engine runs per target table because the data does not exist in any system table.

ANALYZE TABLE … COMPUTE STORAGE METRICS (storage_breakdown_analyze)

Returns a single row of physical size: total_bytes, num_total_files, active_bytes, num_active_files, vacuumable_bytes, num_vacuumable_files, time_travel_bytes, num_time_travel_files. GA but DBR 18.0+ only. Computed at run time, not stored in UC and not returned by DESCRIBE EXTENDED — no history/trend, the engine must run it per-table and persist the result itself.

DESCRIBE EXTENDED / SHOW TBLPROPERTIES (table_props_time_travel_config, iceberg_uniform_metadata)

Delta table properties (delta.logRetentionDuration, delta.deletedFileRetentionDuration, delta.dataSkippingNumIndexedCols, delta.dataSkippingStatsColumns, delta.autoOptimize.optimizeWrite, delta.autoOptimize.autoCompact, delta.enableDeletionVectors) and the "Delta Uniform Iceberg" metadata section. Retention values are CalendarInterval strings (e.g. 'interval 30 days') that must be parsed to days.

Before you run these

  • Databricks system.* schemas aren’t uniformly available — several (e.g. system.query, system.lakeflow) are still in preview or must be enabled per-metastore. A query that returns nothing usually means its schema isn’t enabled for your account yet.
  • Every dollar figure is est · at list (pre-discount, DBU-only from system.billing.list_prices) unless a query explicitly joins account_prices.
  • Sample-output tables are illustrative synthetic rows, never real account data.

Queries in this domain

01Detecting UniForm & Managed-Iceberg Tablesiceberg_uniform_metadataFor a single target table, returns its full extended metadata rows so the "Delta Uniform Iceberg" section can be read to detect whether the table is UniForm / managed-Iceberg enabled.02Liquid Clustering Work and Costpo_clustering_activityPer managed Unity Catalog table, a 30-day summary of how many liquid/automatic CLUSTERING operations ran, the files and bytes they compacted (removed vs. clustered), and the estimated DBUs that clustering consumed.03Clustering Key Churn Detectorpo_clustering_column_churnPer managed table (and per distinct old-to-new/reason signature), the auto-clustering column-selection decisions over the last 30 days — whether the keys changed, the old to new column sets, the stated reason, when it last happened, and how many times.04Data-Skipping Stats Backfill Trackerpo_data_skipping_backfillOne row per managed table and distinct data-skipping column-change set, showing which stat columns Predictive Optimization added, removed, or newly indexed for pruning, plus the bytes and files it scanned to do so, over the trailing 30 days.05Predictive Optimization Cost & Coveragepo_maintenance_cost_by_tableOne row per table x maintenance-type x outcome over the last 30 days, giving the operation count, summed estimated maintenance DBUs, and first/last op times.06VACUUM Storage Reclaimed Per Tablepo_vacuum_reclaimed_bytesOne row per managed table showing how many successful VACUUM operations ran in the last 30 days and how many files, bytes, and estimated DBUs they reclaimed.07Real Table Size Breakdownstorage_breakdown_analyzeA single row of one Delta table's true on-disk footprint, split into active data, time-travel history, and reclaimable (vacuumable) bytes and file counts.08Table Inventory by Type and Formattable_inventory_typeA catalog/schema-level census of every table and view the collector can see, counted by managed/external/view type and by data source format.09Delta Time-Travel & Optimize Settingstable_props_time_travel_configFor one managed Delta table, the seven Delta properties that govern time-travel retention, auto-optimize, data-skipping indexing, and deletion vectors, each with its effective value or default.