<?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 Z-Ordering a Unity Catalog Materialized View in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/56814#M30657</link>
    <description>&lt;P&gt;Hey everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;We're making the move to Unity Catalog from Hive_Metastore and we're running into some issues performing Z-order optimizations on some of our tables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;These tables are, in either place, materialized views created with a "&lt;SPAN&gt;create&lt;/SPAN&gt; &lt;SPAN&gt;or&lt;/SPAN&gt;&lt;SPAN&gt; refresh live &lt;/SPAN&gt;&lt;SPAN&gt;table"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;statement. They have the same schemas and data.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;However, when we try to Z-order these Unity Catalog materialized views, we get the following message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;AnalysisException: &amp;lt;table_name&amp;gt; is a materialized view. 'OPTIMIZE' expects a table.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given that are Hive_metastore equivalent tables are also materalized views, we're unsure why we only error out on the Unity Catalog ones. Has anyone run into this issue, and if so, how did you get around it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2024 21:28:40 GMT</pubDate>
    <dc:creator>Jake2</dc:creator>
    <dc:date>2024-01-09T21:28:40Z</dc:date>
    <item>
      <title>Z-Ordering a Unity Catalog Materialized View</title>
      <link>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/56814#M30657</link>
      <description>&lt;P&gt;Hey everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;We're making the move to Unity Catalog from Hive_Metastore and we're running into some issues performing Z-order optimizations on some of our tables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;These tables are, in either place, materialized views created with a "&lt;SPAN&gt;create&lt;/SPAN&gt; &lt;SPAN&gt;or&lt;/SPAN&gt;&lt;SPAN&gt; refresh live &lt;/SPAN&gt;&lt;SPAN&gt;table"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;statement. They have the same schemas and data.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;However, when we try to Z-order these Unity Catalog materialized views, we get the following message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;AnalysisException: &amp;lt;table_name&amp;gt; is a materialized view. 'OPTIMIZE' expects a table.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given that are Hive_metastore equivalent tables are also materalized views, we're unsure why we only error out on the Unity Catalog ones. Has anyone run into this issue, and if so, how did you get around it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 21:28:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/56814#M30657</guid>
      <dc:creator>Jake2</dc:creator>
      <dc:date>2024-01-09T21:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Z-Ordering a Unity Catalog Materialized View</title>
      <link>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/56978#M30703</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/89126"&gt;@Jake2&lt;/a&gt;&amp;nbsp; -&amp;nbsp; we cannot run OPTIMIZE against materialized views. Please refer to the below limitations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/en/sql/user/materialized-views.html#limitations" target="_blank"&gt;https://docs.databricks.com/en/sql/user/materialized-views.html#limitations&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Shan&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 17:44:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/56978#M30703</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2024-01-11T17:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Z-Ordering a Unity Catalog Materialized View</title>
      <link>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/57889#M30944</link>
      <description>&lt;P&gt;Hi shan_chandra, thanks for the response.&lt;/P&gt;&lt;P&gt;We found that piece of documentation, but there's a couple points that we find vexing about this.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;It mentions that MVs are "Unity Catalog managed tables" - we have been using them on hive_metastore for quite some time now.&lt;/LI&gt;&lt;LI&gt;The limitations do say you can't run ad-hoc OPTIMIZE commands against MVs, but again, we've been doing that for quite some time on our hive_metastore MVs.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;To that point, there isn't a clear indicator as to what's ad-hoc and what isn't. If we wanted to OPTIMIZE the MVs on a non-ad-hoc basis, there isn't anything on the page that shows you how.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I feel like the MVs we have in hive_metastore and the MVs we have in Unity Catalog have fundamentally different behavior and limitations, and it's been a challenge to navigate.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 14:44:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/57889#M30944</guid>
      <dc:creator>Jake2</dc:creator>
      <dc:date>2024-01-19T14:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Z-Ordering a Unity Catalog Materialized View</title>
      <link>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/57891#M30946</link>
      <description>&lt;P&gt;For anyone who's reading this later: You can still Z-order your materialized views, but you can't run it as a SQL command. Instead, you can set it as one of the &lt;A href="https://dpe-aws.docs.databricks.com/en/delta-live-tables/properties.html" target="_self"&gt;TBLPROPERTIES&lt;/A&gt; when you define the table. Here's an example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;create or refresh live table {new_table}
tblproperties (
	"quality" = "gold",
	"pipelines.autoOptimize.zOrderCols" = "KEY_1,KEY_2"
)
as
select * from {old_table}&lt;/LI-CODE&gt;&lt;P&gt;This won't Z-order things immediately, but it will do the Z-ordering during the pipeline's maintenance job. It also means that your tables &lt;EM&gt;won't&lt;/EM&gt; be Z-ordered until the maintenance job has run, and to my knowledge you have little control over when it will run. This can be a problem if you're running the pipelines on a daily basis.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 15:14:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/57891#M30946</guid>
      <dc:creator>Jake2</dc:creator>
      <dc:date>2024-01-19T15:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Z-Ordering a Unity Catalog Materialized View</title>
      <link>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/57904#M30951</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/89126"&gt;@Jake2&lt;/a&gt;&amp;nbsp;- Thanks for your response. The above method to z-order as a part of the DLT pipeline maintenance job will address this. On Comparison between UC materialized views vs Hive metastore materialized views, Materialized views outside of UC are just the tables, fully recomputed. In UC, the underlying architecture is modified to allow an incremental compute.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 18:21:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/z-ordering-a-unity-catalog-materialized-view/m-p/57904#M30951</guid>
      <dc:creator>shan_chandra</dc:creator>
      <dc:date>2024-01-19T18:21:50Z</dc:date>
    </item>
  </channel>
</rss>

