<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unable to apply liquid clustering to a materialized view in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/unable-to-apply-liquid-clustering-to-a-materialized-view/m-p/150368#M53401</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;- The table size is about 2 TB.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- I had already set the liquid clustering keys before creating the materialized view. There were no issues with automatic liquid clustering.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- &lt;SPAN&gt;The issue with the &lt;/SPAN&gt;liquid clustering keys not appearing in the metadata&lt;SPAN&gt; has been resolved. About a day after opening this post, the keys appeared in the metadata correctly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- &lt;SPAN&gt;The slow performance issue persisted for quite some time. However, it now appears to be resolved. The view’s performance is currently the same as the streaming table version of the same data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I was not able to determine the root cause, but the issues seem to have been resolved.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Mar 2026 07:17:08 GMT</pubDate>
    <dc:creator>sebih</dc:creator>
    <dc:date>2026-03-09T07:17:08Z</dc:date>
    <item>
      <title>Unable to apply liquid clustering to a materialized view</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-apply-liquid-clustering-to-a-materialized-view/m-p/144426#M52319</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I am trying to create a materialized view with liquid clustering using the code below. However, I realized that the query performance is slower than that of a streaming table with the same data, liquid clustering, and structure. It appears that liquid clustering is not present when I check the materialized view's metadata information. See the related screenshot. When I created the table as a streaming table, I could see that liquid clustering was applied successfully.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sebih_0-1768820672926.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/23090i783A419D3D072218/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sebih_0-1768820672926.png" alt="sebih_0-1768820672926.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/25059"&gt;@DP&lt;/a&gt;.materialized_view(
    name="final_table",
    cluster_by=["date"],
    cluster_by_auto=True,
    table_properties={
        "delta.autoOptimize.autoCompact": "auto",
        "delta.autoOptimize.optimizeWrite": "true"
    }
)
def final_table():
    return (
        spark.read.table("my_table_1")
        .unionByName(spark.read.table("my_table_2").drop("id"), allowMissingColumns=True)
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Jan 2026 11:15:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-apply-liquid-clustering-to-a-materialized-view/m-p/144426#M52319</guid>
      <dc:creator>sebih</dc:creator>
      <dc:date>2026-01-19T11:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to apply liquid clustering to a materialized view</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-apply-liquid-clustering-to-a-materialized-view/m-p/144456#M52323</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/178220"&gt;@sebih&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Automatic liquid clustering might not select keys for the following reasons:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- The table is too small to benefit from liquid clustering.&lt;/P&gt;&lt;P&gt;- You can apply automatic liquid clustering for all Unity Catalog managed tables, regardless of data and query characteristics. The heuristics decide whether it's cost-beneficial to select clustering keys.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/aws/en/delta/clustering#how-automatic-liquid-clustering-works" target="_blank"&gt;https://docs.databricks.com/aws/en/delta/clustering#how-automatic-liquid-clustering-works&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2026 16:43:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-apply-liquid-clustering-to-a-materialized-view/m-p/144456#M52323</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2026-01-19T16:43:12Z</dc:date>
    </item>
    <item>
      <title>Hi @sebih, Liquid clustering is fully supported on materi...</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-apply-liquid-clustering-to-a-materialized-view/m-p/150259#M53321</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/178220"&gt;@sebih&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Liquid clustering is fully supported on materialized views in Lakeflow Spark Declarative Pipelines (SDP), so the configuration you have should work. There are a couple of things to check that commonly cause clustering to appear missing from the metadata.&lt;/P&gt;
&lt;P&gt;USING BOTH cluster_by AND cluster_by_auto&lt;/P&gt;
&lt;P&gt;Your decorator specifies both cluster_by=["date"] and cluster_by_auto=True at the same time. While these can be combined (the manual columns act as initial hints before automatic selection takes over), it is worth testing with just one to rule out any interaction issue:&lt;/P&gt;
&lt;PRE&gt;@dp.materialized_view(
  name="final_table",
  cluster_by=["date"],
  table_properties={
      "delta.autoOptimize.autoCompact": "auto",
      "delta.autoOptimize.optimizeWrite": "true"
  }
)
def final_table():
  return (
      spark.read.table("my_table_1")
      .unionByName(spark.read.table("my_table_2").drop("id"), allowMissingColumns=True)
  )&lt;/PRE&gt;
&lt;P&gt;Or, if you want fully automatic key selection:&lt;/P&gt;
&lt;PRE&gt;@dp.materialized_view(
  name="final_table",
  cluster_by_auto=True,
  table_properties={
      "delta.autoOptimize.autoCompact": "auto",
      "delta.autoOptimize.optimizeWrite": "true"
  }
)
def final_table():
  ...&lt;/PRE&gt;
&lt;P&gt;FULL REFRESH MAY BE REQUIRED&lt;/P&gt;
&lt;P&gt;If the materialized view was originally created without clustering and you later added cluster_by to the decorator, the existing table may not pick up the clustering configuration until a full refresh is run. A full refresh drops and recreates the table with the new definition. You can trigger one from the pipeline UI by clicking the dropdown next to "Refresh selection" and choosing "Full Refresh selection."&lt;/P&gt;
&lt;P&gt;VERIFYING CLUSTERING METADATA&lt;/P&gt;
&lt;P&gt;After the pipeline update completes, run the following to confirm clustering is in place:&lt;/P&gt;
&lt;PRE&gt;DESCRIBE DETAIL catalog.schema.final_table&lt;/PRE&gt;
&lt;P&gt;Look for the clusteringColumns field in the output. You can also check:&lt;/P&gt;
&lt;PRE&gt;SHOW TBLPROPERTIES catalog.schema.final_table&lt;/PRE&gt;
&lt;P&gt;If cluster_by_auto is enabled, you should see clusterByAuto set to true.&lt;/P&gt;
&lt;P&gt;PIPELINE RUNTIME VERSION&lt;/P&gt;
&lt;P&gt;Liquid clustering on materialized views and streaming tables requires your pipeline to be running on a runtime equivalent to Databricks Runtime 15.2 or higher. If your pipeline is on an older runtime, upgrade it in the pipeline settings. For the best performance, Databricks Runtime 16.4 LTS or newer is recommended.&lt;/P&gt;
&lt;P&gt;PERFORMANCE COMPARISON WITH STREAMING TABLES&lt;/P&gt;
&lt;P&gt;Materialized views are recomputed from scratch on each refresh (unless using an incremental refresh policy), so the data layout after a refresh may differ from a streaming table that applies clustering on write continuously. After a full refresh with clustering enabled, subsequent queries should benefit from the clustered layout. If performance still lags behind the streaming table equivalent, you can also run OPTIMIZE on the materialized view table outside the pipeline to trigger clustering compaction.&lt;/P&gt;
&lt;P&gt;DOCUMENTATION REFERENCES&lt;/P&gt;
&lt;P&gt;- Liquid clustering overview: &lt;A href="https://docs.databricks.com/en/delta/clustering.html" target="_blank"&gt;https://docs.databricks.com/en/delta/clustering.html&lt;/A&gt;&lt;BR /&gt;
- CREATE MATERIALIZED VIEW with CLUSTER BY: &lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-create-materialized-view.html" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-create-materialized-view.html&lt;/A&gt;&lt;BR /&gt;
- Python materialized_view decorator reference: &lt;A href="https://docs.databricks.com/aws/en/ldp/developer/ldp-python-ref-materialized-view" target="_blank"&gt;https://docs.databricks.com/aws/en/ldp/developer/ldp-python-ref-materialized-view&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;* This reply used an agent system I built to research and draft this response based on the wide set of documentation I have available and previous memory. I personally review the draft for any obvious issues and for monitoring system reliability and update it when I detect any drift, but there is still a small chance that something is inaccurate, especially if you are experimenting with brand new features.&lt;/P&gt;
&lt;P&gt;If this answer resolves your question, could you mark it as "Accept as Solution"? That helps other users quickly find the correct fix.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Mar 2026 20:59:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-apply-liquid-clustering-to-a-materialized-view/m-p/150259#M53321</guid>
      <dc:creator>SteveOstrowski</dc:creator>
      <dc:date>2026-03-08T20:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to apply liquid clustering to a materialized view</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-apply-liquid-clustering-to-a-materialized-view/m-p/150368#M53401</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;- The table size is about 2 TB.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- I had already set the liquid clustering keys before creating the materialized view. There were no issues with automatic liquid clustering.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- &lt;SPAN&gt;The issue with the &lt;/SPAN&gt;liquid clustering keys not appearing in the metadata&lt;SPAN&gt; has been resolved. About a day after opening this post, the keys appeared in the metadata correctly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- &lt;SPAN&gt;The slow performance issue persisted for quite some time. However, it now appears to be resolved. The view’s performance is currently the same as the streaming table version of the same data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I was not able to determine the root cause, but the issues seem to have been resolved.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2026 07:17:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-apply-liquid-clustering-to-a-materialized-view/m-p/150368#M53401</guid>
      <dc:creator>sebih</dc:creator>
      <dc:date>2026-03-09T07:17:08Z</dc:date>
    </item>
  </channel>
</rss>

