<?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: optimize way to Join between two group by statements in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455226#M98402</link>
    <description>&lt;P&gt;There are several approaches thinkable which may reduce the RAM consumption but the most obvious one would be to implement an incremental logic.&lt;/P&gt;
&lt;P&gt;Personally I would tend to distribute such task to at least two layers and the first one would be the slicing of ABC in YYYYMM periods and storing them into qvd's. Similar would it be with the XYZ join-data and the join would then be applied within the next layer.&lt;/P&gt;
&lt;P&gt;Beside this you may try to remove the autonumber() from the joins because I'm not sure at which work-step the autonumber() released the RAM. Also a storing of the entire ABC as qvd is an option and would mean that the autonumber() couldn't remain. Depending on the Cust_ID and Brand you might be able to create a numeric concatenation instead of a string one.&lt;/P&gt;
&lt;P&gt;A further reducing might be the filtering of the join-table against the existing ABC key-values - maybe also in a workstep in beforehand and then loading it as mapping table and merging then the data per:&lt;/P&gt;
&lt;P&gt;subfield(applymap())&lt;/P&gt;
&lt;P&gt;instead of the join.&lt;/P&gt;
&lt;P&gt;Before you goes in any direction it would be helpful just to load ABC and the looking how many RAM is consumed and of course further available to get a feeling if your environment is general suitable sized for your wanted data-set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 13:07:36 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2024-05-22T13:07:36Z</dc:date>
    <item>
      <title>optimize way to Join between two group by statements</title>
      <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455080#M98387</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;
&lt;P&gt;Below code works for me on limited data set but on full load app throws Object out of memory.&lt;/P&gt;
&lt;P&gt;Is there better/optimize way to tackle below code?&lt;/P&gt;
&lt;P&gt;Granularity of data is at month level and Join condition between two tables is below Composite Key.&lt;/P&gt;
&lt;P&gt;without left join..numbers from Table 'ABC' are not giving the desired results..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;ABC:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; AutoNumber(Month &amp;amp; '|' &amp;amp; Cust_ID &amp;amp; '|' &amp;amp; Brand) as Key,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; Month,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Status,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Brand ,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; TOTAL_CUSTOMERS&lt;/DIV&gt;
&lt;DIV&gt;;&lt;/DIV&gt;
&lt;DIV&gt;select&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;distinct Cust_ID,&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; Month,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Status,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Brand ,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Count(distinct Cust_ID) TOTAL_CUSTOMERS&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;from table1&lt;/DIV&gt;
&lt;DIV&gt;Group by 1,2,3,4;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;left join (ABC)&lt;/DIV&gt;
&lt;DIV&gt;XYZ:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; AutoNumber(Month &amp;amp; '|' &amp;amp; Cust_ID &amp;amp; '|' &amp;amp; Brand) as Key,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Outlet_FLAG,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Brand AS Brand_XYZ,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Expected_Cust&amp;nbsp; &amp;nbsp;//need to calculate count of customer where expected cust= 'Yes'..Count(Dist Cust_id)&lt;/DIV&gt;
&lt;DIV&gt;FROM XYZ.qvd(qvd);&lt;/DIV&gt;</description>
      <pubDate>Wed, 22 May 2024 09:17:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455080#M98387</guid>
      <dc:creator>T_Qlik</dc:creator>
      <dc:date>2024-05-22T09:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: optimize way to Join between two group by statements</title>
      <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455098#M98388</link>
      <description>&lt;P&gt;you can simply keep the tables as are&lt;BR /&gt;qlik will link them via Key&lt;BR /&gt;and you calculate the count on the UI&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Count(Distict {&amp;lt;Expected_Cust={"yes"}&amp;gt;} Cust_id)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 09:45:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455098#M98388</guid>
      <dc:creator>ali_hijazi</dc:creator>
      <dc:date>2024-05-22T09:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: optimize way to Join between two group by statements</title>
      <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455100#M98389</link>
      <description>&lt;P&gt;I know but in my case data volume is on higher side and app throws out of object memory error&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 09:47:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455100#M98389</guid>
      <dc:creator>T_Qlik</dc:creator>
      <dc:date>2024-05-22T09:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: optimize way to Join between two group by statements</title>
      <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455101#M98390</link>
      <description>&lt;P&gt;Plus without left join count from table 'ABC' is not giving the desired O/P.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 09:48:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455101#M98390</guid>
      <dc:creator>T_Qlik</dc:creator>
      <dc:date>2024-05-22T09:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: optimize way to Join between two group by statements</title>
      <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455132#M98391</link>
      <description>&lt;P&gt;It's not clear for me - the load runs into a memory error or afterwards any UI object?&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 10:33:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455132#M98391</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2024-05-22T10:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: optimize way to Join between two group by statements</title>
      <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455134#M98392</link>
      <description>&lt;P&gt;Load runs into memory error&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 10:41:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455134#M98392</guid>
      <dc:creator>T_Qlik</dc:creator>
      <dc:date>2024-05-22T10:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: optimize way to Join between two group by statements</title>
      <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455158#M98393</link>
      <description>&lt;P&gt;The load with just a few fields and the group by inside of the sql looked rather small and I wouldn't expect memory issues unless the datasets are really huge and going into billions of records. Therefore how many records are there and how many free RAM is available? Further make sure that there are no further data within the data-model before you perform this joining.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 11:20:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455158#M98393</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2024-05-22T11:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: optimize way to Join between two group by statements</title>
      <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455186#M98398</link>
      <description>&lt;P&gt;Close to 1.3 billion records from table 'ABC'.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 12:21:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455186#M98398</guid>
      <dc:creator>T_Qlik</dc:creator>
      <dc:date>2024-05-22T12:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: optimize way to Join between two group by statements</title>
      <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455226#M98402</link>
      <description>&lt;P&gt;There are several approaches thinkable which may reduce the RAM consumption but the most obvious one would be to implement an incremental logic.&lt;/P&gt;
&lt;P&gt;Personally I would tend to distribute such task to at least two layers and the first one would be the slicing of ABC in YYYYMM periods and storing them into qvd's. Similar would it be with the XYZ join-data and the join would then be applied within the next layer.&lt;/P&gt;
&lt;P&gt;Beside this you may try to remove the autonumber() from the joins because I'm not sure at which work-step the autonumber() released the RAM. Also a storing of the entire ABC as qvd is an option and would mean that the autonumber() couldn't remain. Depending on the Cust_ID and Brand you might be able to create a numeric concatenation instead of a string one.&lt;/P&gt;
&lt;P&gt;A further reducing might be the filtering of the join-table against the existing ABC key-values - maybe also in a workstep in beforehand and then loading it as mapping table and merging then the data per:&lt;/P&gt;
&lt;P&gt;subfield(applymap())&lt;/P&gt;
&lt;P&gt;instead of the join.&lt;/P&gt;
&lt;P&gt;Before you goes in any direction it would be helpful just to load ABC and the looking how many RAM is consumed and of course further available to get a feeling if your environment is general suitable sized for your wanted data-set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 13:07:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455226#M98402</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2024-05-22T13:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: optimize way to Join between two group by statements</title>
      <link>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455257#M98405</link>
      <description>&lt;P&gt;A couple of thoughts.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;AutoNumberHash128(Month, Cust_ID, Brand) as Key&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;may use less memory than AutoNumber.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You mentioned you were not getting correct results when kept as separate tables. That may be because you have extra rows that are remove by the Left Join. Try keeping as separate tables but with a where exists() to filter.&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;XYZ:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; AutoNumberHash128(Month, Cust_ID, Brand) as Key,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Outlet_FLAG,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Brand AS Brand_XYZ,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; Expected_Cust&amp;nbsp; &amp;nbsp;//need to calculate count of customer where expected cust= 'Yes'..Count(Dist Cust_id)&lt;/DIV&gt;
&lt;DIV&gt;FROM XYZ.qvd(qvd)&lt;/DIV&gt;
&lt;DIV&gt;Where Exists(Key,&amp;nbsp;AutoNumberHash128(Month, Cust_ID, Brand) )&lt;BR /&gt;;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;1.3 Billion rows can be challenging &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;-Rob&lt;/DIV&gt;</description>
      <pubDate>Wed, 22 May 2024 14:08:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/optimize-way-to-Join-between-two-group-by-statements/m-p/2455257#M98405</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2024-05-22T14:08:11Z</dc:date>
    </item>
  </channel>
</rss>

