<?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: JOIN Two Big Tables, each being some terabytes. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/join-two-big-tables-each-being-some-terabytes/m-p/109914#M43430</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/145131"&gt;@subhas_hati&lt;/a&gt;,&lt;/P&gt;
&lt;P class="_1t7bu9h1 paragraph"&gt;Enable AQE to dynamically optimize the join strategy at runtime based on the actual data distribution. This can help in choosing the best join strategy automatically&lt;/P&gt;
&lt;P class="_1t7bu9h1 paragraph"&gt;If you are using Delta tables, you can leverage the &lt;CODE&gt;MERGE&lt;/CODE&gt; statement with schema evolution and other optimizations:&lt;/P&gt;
&lt;DIV class="gb5fhw2"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-sql _1t7bu9hb hljs language-sql gb5fhw3"&gt;&lt;SPAN class="hljs-keyword"&gt;MERGE&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;INTO&lt;/SPAN&gt; target_table &lt;SPAN class="hljs-keyword"&gt;AS&lt;/SPAN&gt; tgt
&lt;SPAN class="hljs-keyword"&gt;USING&lt;/SPAN&gt; source_table &lt;SPAN class="hljs-keyword"&gt;AS&lt;/SPAN&gt; src
&lt;SPAN class="hljs-keyword"&gt;ON&lt;/SPAN&gt; tgt.key &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; src.key
&lt;SPAN class="hljs-keyword"&gt;WHEN&lt;/SPAN&gt; MATCHED &lt;SPAN class="hljs-keyword"&gt;THEN&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;UPDATE&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;SET&lt;/SPAN&gt; tgt.col1 &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; src.col1
&lt;SPAN class="hljs-keyword"&gt;WHEN&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;NOT&lt;/SPAN&gt; MATCHED &lt;SPAN class="hljs-keyword"&gt;THEN&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;INSERT&lt;/SPAN&gt; (key, col1) &lt;SPAN class="hljs-keyword"&gt;VALUES&lt;/SPAN&gt; (src.key, src.col1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-qry-select-hints.html#join-hint-types" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-qry-select-hints.html#join-hint-types&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Feb 2025 21:47:47 GMT</pubDate>
    <dc:creator>Alberto_Umana</dc:creator>
    <dc:date>2025-02-11T21:47:47Z</dc:date>
    <item>
      <title>JOIN Two Big Tables, each being some terabytes.</title>
      <link>https://community.databricks.com/t5/data-engineering/join-two-big-tables-each-being-some-terabytes/m-p/109908#M43427</link>
      <description>&lt;P&gt;What is the strategy for joinning two big tables, each being some terrabytes.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 21:34:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/join-two-big-tables-each-being-some-terabytes/m-p/109908#M43427</guid>
      <dc:creator>subhas_hati</dc:creator>
      <dc:date>2025-02-11T21:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: JOIN Two Big Tables, each being some terabytes.</title>
      <link>https://community.databricks.com/t5/data-engineering/join-two-big-tables-each-being-some-terabytes/m-p/109914#M43430</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/145131"&gt;@subhas_hati&lt;/a&gt;,&lt;/P&gt;
&lt;P class="_1t7bu9h1 paragraph"&gt;Enable AQE to dynamically optimize the join strategy at runtime based on the actual data distribution. This can help in choosing the best join strategy automatically&lt;/P&gt;
&lt;P class="_1t7bu9h1 paragraph"&gt;If you are using Delta tables, you can leverage the &lt;CODE&gt;MERGE&lt;/CODE&gt; statement with schema evolution and other optimizations:&lt;/P&gt;
&lt;DIV class="gb5fhw2"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-sql _1t7bu9hb hljs language-sql gb5fhw3"&gt;&lt;SPAN class="hljs-keyword"&gt;MERGE&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;INTO&lt;/SPAN&gt; target_table &lt;SPAN class="hljs-keyword"&gt;AS&lt;/SPAN&gt; tgt
&lt;SPAN class="hljs-keyword"&gt;USING&lt;/SPAN&gt; source_table &lt;SPAN class="hljs-keyword"&gt;AS&lt;/SPAN&gt; src
&lt;SPAN class="hljs-keyword"&gt;ON&lt;/SPAN&gt; tgt.key &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; src.key
&lt;SPAN class="hljs-keyword"&gt;WHEN&lt;/SPAN&gt; MATCHED &lt;SPAN class="hljs-keyword"&gt;THEN&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;UPDATE&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;SET&lt;/SPAN&gt; tgt.col1 &lt;SPAN class="hljs-operator"&gt;=&lt;/SPAN&gt; src.col1
&lt;SPAN class="hljs-keyword"&gt;WHEN&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;NOT&lt;/SPAN&gt; MATCHED &lt;SPAN class="hljs-keyword"&gt;THEN&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;INSERT&lt;/SPAN&gt; (key, col1) &lt;SPAN class="hljs-keyword"&gt;VALUES&lt;/SPAN&gt; (src.key, src.col1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-qry-select-hints.html#join-hint-types" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-qry-select-hints.html#join-hint-types&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 21:47:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/join-two-big-tables-each-being-some-terabytes/m-p/109914#M43430</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2025-02-11T21:47:47Z</dc:date>
    </item>
  </channel>
</rss>

