<?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: Which is more efficient - INNER JOIN or WHERE in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Which-is-more-efficient-INNER-JOIN-or-WHERE/m-p/1917134#M10539</link>
    <description>&lt;P&gt;In my opinion, #2 would generally be the wrong way to go about it. The "correct" equivalent for #2 would be to load Approved Products first and then load&amp;nbsp; All Products using&amp;nbsp; "Where Exists(Product_Number)".&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TempProducts:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LOAD Product_Number&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;From Approved_Products ...;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;All_Products:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LOAD *&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;From All_Products.qvd (qvd)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Where Exists (Product_Number);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Drop Table TempProducts;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;This is especially effective if All_Products is loaded from a QVD as Where Exists() will be an optimized load.&amp;nbsp; That is the most resource efficient solution because where exists is fast and Qlik will use the least memory by filtering as it builds the table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you must filter All_Products from a resident table, using Inner Join is the best approach.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Inner Join (All_Products)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load&amp;nbsp;Product_Number&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;From ...;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Memory for two tables will exist for the period of the Join, but Qlik will automatically take care of dropping the old table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "Where Match()" approach would also allocate memory for two tables, and additionally it would be the most compute intensive of the options.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank" rel="noopener"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank" rel="noopener"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank" rel="noopener"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2022 23:23:36 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2022-04-11T23:23:36Z</dc:date>
    <item>
      <title>Which is more efficient - INNER JOIN or WHERE</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Which-is-more-efficient-INNER-JOIN-or-WHERE/m-p/1917107#M10538</link>
      <description>&lt;P&gt;A question was brought up during our SCRUM call this morning, and no one could give an answer. Lets say you have two tables:&lt;/P&gt;
&lt;P&gt;Approved Products:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%" class="lia-align-center"&gt;&lt;STRONG&gt;Product_Number&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;123abc&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;456def&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All Products:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px" class="lia-align-center"&gt;&lt;STRONG&gt;Product_Number&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="50%" height="25px" class="lia-align-center"&gt;&lt;STRONG&gt;Product_Name&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px"&gt;123abc&lt;/TD&gt;
&lt;TD width="50%" height="25px"&gt;Shoe&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px"&gt;456def&lt;/TD&gt;
&lt;TD width="50%" height="25px"&gt;Shirt&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px"&gt;789ghi&lt;/TD&gt;
&lt;TD width="50%" height="25px"&gt;Pants&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px"&gt;101112jkl&lt;/TD&gt;
&lt;TD width="50%" height="25px"&gt;Belt&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you want the resulting table to be the All Products table, but only with the Approved Products in it.&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%" class="lia-align-center"&gt;&lt;STRONG&gt;Product_Number&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="50%" class="lia-align-center"&gt;&lt;STRONG&gt;Product_Name&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;123abc&lt;/TD&gt;
&lt;TD width="50%"&gt;Shoe&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;456def&lt;/TD&gt;
&lt;TD width="50%"&gt;Shirt&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The two solutions we were debating between are:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;Solution #1: LOAD * RESIDENT All Products INNER JOIN LOAD Product_Number RESIDENT Approved Products&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;or&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;Solution #2: First create a comma separated&amp;nbsp;list of the values from Approved Products, vList. Then use that value in the where clause - i.e. LOAD * RESIDENT All Products WHERE Product_Number MATCH(Product_Number, $(vList))&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Both of these solutions will get me the same result, but I am curious as to which of these are the optimal solution. For some reason, joining out to a table seems like it would require more resources, but that is literally just a feeling I have. Huge bonus points if you even know why one is more optimal than the other.&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Gage&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 21:43:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Which-is-more-efficient-INNER-JOIN-or-WHERE/m-p/1917107#M10538</guid>
      <dc:creator>gagewhite</dc:creator>
      <dc:date>2022-04-11T21:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Which is more efficient - INNER JOIN or WHERE</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Which-is-more-efficient-INNER-JOIN-or-WHERE/m-p/1917134#M10539</link>
      <description>&lt;P&gt;In my opinion, #2 would generally be the wrong way to go about it. The "correct" equivalent for #2 would be to load Approved Products first and then load&amp;nbsp; All Products using&amp;nbsp; "Where Exists(Product_Number)".&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;TempProducts:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LOAD Product_Number&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;From Approved_Products ...;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;All_Products:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;LOAD *&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;From All_Products.qvd (qvd)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Where Exists (Product_Number);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Drop Table TempProducts;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;This is especially effective if All_Products is loaded from a QVD as Where Exists() will be an optimized load.&amp;nbsp; That is the most resource efficient solution because where exists is fast and Qlik will use the least memory by filtering as it builds the table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you must filter All_Products from a resident table, using Inner Join is the best approach.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Inner Join (All_Products)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load&amp;nbsp;Product_Number&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;From ...;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Memory for two tables will exist for the period of the Join, but Qlik will automatically take care of dropping the old table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "Where Match()" approach would also allocate memory for two tables, and additionally it would be the most compute intensive of the options.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank" rel="noopener"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank" rel="noopener"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank" rel="noopener"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 23:23:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Which-is-more-efficient-INNER-JOIN-or-WHERE/m-p/1917134#M10539</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2022-04-11T23:23:36Z</dc:date>
    </item>
  </channel>
</rss>

