Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Databricks · Databricks Data Engineer Professional

Managed tables, liquid clustering, and deletion vectors

Databricks Data Engineer Professional · Lesson 14 of 21 · 1:50:48

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Databricks Certified Data Engineer Professional exam. In this lesson: Unity Catalog managed tables and predictive optimization, liquid clustering, and partitions, Z-order, and deletion vectors. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Maintenance by hand

Quayside Eats created its order tables years ago, partitioned by date and Z-ordered by restaurant, and an engineer runs optimize and vacuum by hand every weekend. Queries now filter by city more than by restaurant, small files pile up, and every correction rewrites whole files. This lesson covers managed tables, predictive optimization, liquid clustering, partitioning, and deletion vectors.

Managed tables and predictive optimization

Unity Catalog managed tables let Databricks manage the storage, the file layout, and the maintenance, and Databricks recommends them for new tables. Predictive optimization runs optimize, vacuum, and analyze automatically on managed tables, when it judges that they help, so no maintenance job is needed. Managed tables also tune their file sizes automatically, from the size of the table and its workload. Statistics for data skipping are collected on the columns that matter, chosen by predictive optimization, instead of only the first thirty two columns. External tables keep their data in a location that you manage, and they do not get these features.

Liquid clustering

Liquid clustering organizes data by clustering keys, set with cluster by, and Databricks recommends it for new tables, instead of partitioning or Z-order. The keys can change at any time without rewriting the existing data, and new writes and optimize runs then cluster by the new keys. With cluster by auto, on managed tables, Databricks chooses the keys from the query history, and changes them as the queries change. Choose up to four keys among the columns that queries filter on most, and an existing partitioned table can move to clustering with an alter table command. Liquid clustering cannot be combined with partitioning or Z-order on the same table.

Partitions, Z-order, deletion vectors

Partitioning splits a table into folders by a column, and below one terabyte, Databricks advises not to partition at all, since it creates small files. From one to one hundred terabytes, liquid clustering is the better choice, and partitioning, if any, only helps on very large tables, with a coarse column like a date. Z-order, run with optimize Z-order by, puts related values in the same files for data skipping, but it rewrites data at each run, and it does not work with liquid clustering. Deletion vectors let delete, update, and merge mark rows as removed, instead of rewriting whole Parquet files, and readers skip those rows. The files are rewritten later, by optimize, or by reorg table apply purge when the rows must leave the files. And the table property delta.enableDeletionVectors controls them.

Recap

Let's recap. Unity Catalog managed tables tune their file sizes, and predictive optimization runs optimize, vacuum, and analyze for you. Liquid clustering, with cluster by or cluster by auto, replaces partitioning and Z-order for new tables, and its keys can change without a rewrite. Below one terabyte, do not partition, and from one to one hundred terabytes, prefer liquid clustering. Deletion vectors mark removed rows, instead of rewriting whole files. And optimize, or reorg table apply purge, rewrites the files later.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. A team runs a weekly job that calls OPTIMIZE and VACUUM on forty managed tables, and it often forgets the new ones. What should the team do?

    • Run the same job every day instead
    • Partition the tables by date
    • Convert the tables to external tables
    • Let predictive optimization maintain them
    Show the answer

    Let predictive optimization maintain them

    Predictive optimization maintains every managed table automatically, including new ones, so the job can go. “Run the same job every day instead” would run the same job more often, and still miss new tables. “Partition the tables by date” would change the layout, and still need maintenance. And “Convert the tables to external tables” would remove the managed features, including predictive optimization.

  2. The orders table uses liquid clustering by restaurant, and queries now filter mostly by city. The team wants to cluster by city from now on, without rewriting the table today. What should the data engineer run?

    • Recreate the table, partitioned by city
    • OPTIMIZE ... ZORDER BY (city)
    • ALTER TABLE ... CLUSTER BY (city)
    • Add a generated column for the city
    Show the answer

    ALTER TABLE ... CLUSTER BY (city)

    Alter table with cluster by changes the keys at once, and only new writes and later optimize runs use them. “Recreate the table, partitioned by city” would rewrite the whole table, and go back to partitioning. “OPTIMIZE ... ZORDER BY (city)” cannot be used on a table with liquid clustering. And “Add a generated column for the city” would add a column, without changing the layout.

  3. A 200 GB orders table is partitioned by order date and by restaurant, holds many small files, and its queries are slow. What should the data engineer do?

    • Add a third partition column, the city
    • Replace the partitioning with liquid clustering
    • Run OPTIMIZE ZORDER BY every hour
    • Turn off deletion vectors on the table
    Show the answer

    Replace the partitioning with liquid clustering

    Below one terabyte, partitioning only adds small files, and liquid clustering gives data skipping without them. “Add a third partition column, the city” would add a third level of folders, and even more small files. “Run OPTIMIZE ZORDER BY every hour” would still be limited by the partitions, and rewrite data at each run. And “Turn off deletion vectors on the table” would only change how deletes are written, not how the table is laid out.