Harnessing the Potential of Databricks Liquid Clustering: A Dynamic Data Layout Scaling with Growth of Data

Balachandar Paulraj
3 min readJan 3, 2024

Databricks made waves at the previous Data + AI Summit by introducing Liquid Clustering alongside Delta Universal Format (UniForm) and Delta kernel. This novel approach is designed to enhance both read and write performance through a dynamic data layout.

Delve into this post for a detailed exploration of Liquid Clustering and insightful perspectives.

Databricks Liquid Clustering


Crafting a partitioning strategy for a data lakehouse is no easy task, as it requires a balance between current query patterns and adaptability to evolving workloads. The challenge lies in the fixed data layout, demanding meticulous planning upfront. Despite the best initial efforts, changing query patterns over time render the original partitioning strategy inefficient and costly. Additionally, maintaining even data distribution across partitions becomes crucial for sustained read/write performance.



The above illustration vividly demonstrates the evolution of file counts, shedding light on the challenge of maintaining an optimized partitioning approach despite best initial efforts. Despite commencing with uniformly sized files across all partitions, subsequent transformations resulted in an abundance of small files or a single large file, depending on the specific operation. The partition that demonstrated effectiveness in the past may now be deemed suboptimal. It requires frequent additional efforts to validate and update the partition layout to keep it optimal.


Currently, Delta tables leverage optimization techniques like Table Partitioning and Z-Order. Table Partitioning divides data into logical segments based on specific columns, simplifying data subset retrieval. Conversely, Z-Order rearranges data files within each partition, grouping related values to minimize scan volumes during queries. This boosts compression, filtration, and reduces overall I/O operations.

Despite their potential to greatly enhance read performance, the implementation of these two techniques might introduce a slight trade-off, slowing down write operations due to the necessary data reorganization when new data is appended. A carefully crafted partitioning strategy, while beneficial, can still result in suboptimal performance or a decrease in query speeds, depending on the columns chosen for partitioning or Z-Ordering.


A dynamic data management solution tailored for Delta tables. This intelligent technique adapts seamlessly to clustering keys, ensuring a flexible and automatic adjustment of the data layout.

By dynamically clustering data according to patterns, Liquid Clustering mitigates the challenges of over-partitioning or under-partitioning.

Enabling Liquid Clustering

To activate Liquid Clustering, it’s recommended to use Databricks Runtime 13.3 LTS or a later version. Employ the existing Databricks command OPTIMIZE to enable Liquid Clustering on the respective table.

OPTIMIZE <table_name>

In an incremental fashion, Liquid Clustering ensures that data is rewritten only as needed to accommodate the clustering of specific data. Data files with clustering keys that do not match the data to be clustered remain untouched.

Referencing the official Databricks documentation, here are some key features of Liquid Clustering, along with recommendations for selecting clustering keys and its associated limitations.

Key Features

  • Liquid Clustering simplifies configuration by allowing you to focus on keys from the columns most commonly queried, alleviating worries about traditional considerations like column cardinality, partition ordering, or the creation of artificial columns to serve as perfect partitioning keys
  • Liquid Clustering progressively clusters incoming data, eliminating the need for trade-offs between performance enhancement and cost/write amplification reduction
  • Liquid Clustering allows for the swift adjustment of clustered columns, all without the hassle of rewriting existing data

Recommendations for choosing clustering keys

  1. Use partition columns as clustering keys.
  2. Use the ZORDER BY columns as clustering keys.
  3. Use both partition columns and ZORDER BY columns as clustering keys.
  4. Use the original column as a clustering key, and don’t create a generated column.

Limitations of Liquid Clustering

  • Much like Z-ordering, clustering is applicable only to columns with collected statistics. The default behavior is to collect statistics for the first 32 columns in a Delta table.
  • Only a maximum of 4 columns can be specified as clustering keys.