<?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: Performance of Cross table load vs for loop in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Performance-of-Cross-table-load-vs-for-loop/m-p/552826#M688034</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dathu,&lt;/P&gt;&lt;P&gt;thanks for your input.&lt;/P&gt;&lt;P&gt;If an incremental load is possible for the crosstable then I should also be able to do that for the for loop alternative. The performance gain would (probably) be similar for both alternatives and the crosstable load would therefore still be slower.&amp;nbsp; I have tested the 2 alternatives with different sizes of input data which would simulate the lesser amount of source data that an incremental load would give me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My issue is with the performance of the crosstable load. I just cannot understand why the crosstable load is so slow. The for/where solution to me is a very costly/bad solution which i didn't really think would be quicker than a built in algorithm.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Nov 2013 09:09:52 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-11-21T09:09:52Z</dc:date>
    <item>
      <title>Performance of Cross table load vs for loop</title>
      <link>https://community.qlik.com/t5/QlikView/Performance-of-Cross-table-load-vs-for-loop/m-p/552824#M688032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having some issues with the cross table load performance. It is performing worse than a for loop with a where statement producing the same output table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table with columns as follows&lt;/P&gt;&lt;P&gt;&lt;IMG alt="crosstable_example_1.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/49282_crosstable_example_1.png" style="width: 620px; height: 38px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to transform it to this:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="crosstable_example_2.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/49286_crosstable_example_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem as I mentioned is that I am getting better performance from a for loop with a where clause than from cross table load.&lt;/P&gt;&lt;P&gt;Here is an example of the code of the for loop that beats the cross table load.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13849619814649821" jivemacro_uid="_13849619814649821" modifiedtitle="true"&gt;
&lt;P&gt;set sFromDate = 2013-01-01;&lt;/P&gt;
&lt;P&gt;set sFromDate = 2013-01-01;&lt;/P&gt;
&lt;P&gt;set sTodate =&amp;nbsp; 2014-01-01;&lt;/P&gt;
&lt;P&gt;let vParameterNames = 'running','skiing','jumping','swimming','flying','skating','playing','sleeping','viewing','greeting','chasing','lying','basking';&lt;/P&gt;
&lt;P&gt;for each parametername in $(vParameterNames)&lt;/P&gt;
&lt;P&gt;Activity:&lt;/P&gt;
&lt;P&gt;load&lt;/P&gt;
&lt;P&gt;Key,&lt;/P&gt;
&lt;P&gt;Activity.$(parametername) as Activity.Score,&lt;/P&gt;
&lt;P&gt;'$(parametername)' as Activity.ParameterName,&lt;/P&gt;
&lt;P&gt;applymap('MapParameterToGroup', '$(parametername)-'&amp;amp;TemplateID,'') as Activity.ParameterGroupName&lt;/P&gt;
&lt;P&gt;FROM '$(sFileName)' (qvd)&lt;/P&gt;
&lt;P&gt;where Activity.$(parametername) &amp;gt;= 0&lt;/P&gt;
&lt;P&gt;and date#(BKDate,'YYYY-MM-DD') &amp;gt;= date#('$(sFromDate)','YYYY-MM-DD') and date#(BKDate,'YYYY-MM-DD') &amp;lt; date#('$(sToDate)','YYYY-MM-DD')&lt;/P&gt;
&lt;P&gt;and TOTAL_SECONDS &amp;gt; 0;&lt;/P&gt;
&lt;P&gt;next&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="text-align: left;"&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;And here is the code for the crosstable loaded table:&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="_jivemacro_uid_13849621510968625 jive_text_macro jive_macro_code" jivemacro_uid="_13849621510968625"&gt;
&lt;P&gt;set sFromDate = 2013-01-01;&lt;/P&gt;
&lt;P&gt;set sTodate =&amp;nbsp; 2014-01-01&lt;/P&gt;
&lt;P&gt;let vParameterNames = 'running','skiing','jumping','swimming','flying','skating','playing','sleeping','viewing','greeting','chasing','lying','basking'&lt;/P&gt;
&lt;P&gt;Activity_temp:&lt;/P&gt;
&lt;P&gt;crosstable (Activity.ParameterName, Activity.Score,2) load *;&lt;/P&gt;
&lt;P&gt;load&lt;/P&gt;
&lt;P&gt;Key,&lt;/P&gt;
&lt;P&gt;TemplateID,&lt;/P&gt;
&lt;P&gt;Activity.running as running,&lt;/P&gt;
&lt;P&gt;Activity.skiing as skiing,&lt;/P&gt;
&lt;P&gt;Activity.jumping as jumping,&lt;/P&gt;
&lt;P&gt;Activity.swimming as swimming,&lt;/P&gt;
&lt;P&gt;Activity.flying as flying,&lt;/P&gt;
&lt;P&gt;Activity.skating as skating,&lt;/P&gt;
&lt;P&gt;Activity.playing as playing,&lt;/P&gt;
&lt;P&gt;Activity.sleeping as sleeping,&lt;/P&gt;
&lt;P&gt;Activity.viewing as viewing,&lt;/P&gt;
&lt;P&gt;Activity.greeting as greeting,&lt;/P&gt;
&lt;P&gt;Activity.chasing as chasing,&lt;/P&gt;
&lt;P&gt;Activity.lying as lying,&lt;/P&gt;
&lt;P&gt;Activity.basking as basking&lt;/P&gt;
&lt;P&gt;FROM '$(sFileName)' (qvd)&lt;/P&gt;
&lt;P&gt;where date#(BKDate,'YYYY-MM-DD') &amp;gt;= date#('$(sFromDate)','YYYY-MM-DD') and date#(BKDate,'YYYY-MM-DD') &amp;lt; date#('$(sToDate)','YYYY-MM-DD')&lt;/P&gt;
&lt;P&gt;and TOTAL_SECONDS &amp;gt; 0;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Activity:&lt;/P&gt;
&lt;P&gt;load&lt;/P&gt;
&lt;P&gt;Key,&lt;/P&gt;
&lt;P&gt;Activity.ParameterName,&lt;/P&gt;
&lt;P&gt;Activity.Score,&lt;/P&gt;
&lt;P&gt;applymap('MapParameterToGroup', Activity.ParameterName &amp;amp; '-'&amp;amp;TemplateID,'') as Activity.ParameterGroupName&lt;/P&gt;
&lt;P&gt;resident Activity_temp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;drop table Activity_temp;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The crosstable performs amost equally as the for loop. if needing to split the crosstable in two tables then using the for loop is quicker than the cross table load. In my experiment with 1,000,000 rows and 13 columns the for loop finished in 60 seconds and the crosstable in 72 seconds. For me both are too slow when data size increases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately i need to transpose the table in order to display the data nicely in a straight table with horizontal linear gauge.&lt;/P&gt;&lt;P&gt;Hopefullly i am abusing the cross table load somehow in a way that it can be speeded up! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;My other option is to create an extension object but then i have the problem of not being able to print that in a pdf report which is required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone had similar issues?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Johan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Nov 2013 15:53:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Performance-of-Cross-table-load-vs-for-loop/m-p/552824#M688032</guid>
      <dc:creator />
      <dc:date>2013-11-20T15:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of Cross table load vs for loop</title>
      <link>https://community.qlik.com/t5/QlikView/Performance-of-Cross-table-load-vs-for-loop/m-p/552825#M688033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be you can implement the incremental load on cross table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Nov 2013 17:17:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Performance-of-Cross-table-load-vs-for-loop/m-p/552825#M688033</guid>
      <dc:creator />
      <dc:date>2013-11-20T17:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of Cross table load vs for loop</title>
      <link>https://community.qlik.com/t5/QlikView/Performance-of-Cross-table-load-vs-for-loop/m-p/552826#M688034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dathu,&lt;/P&gt;&lt;P&gt;thanks for your input.&lt;/P&gt;&lt;P&gt;If an incremental load is possible for the crosstable then I should also be able to do that for the for loop alternative. The performance gain would (probably) be similar for both alternatives and the crosstable load would therefore still be slower.&amp;nbsp; I have tested the 2 alternatives with different sizes of input data which would simulate the lesser amount of source data that an incremental load would give me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My issue is with the performance of the crosstable load. I just cannot understand why the crosstable load is so slow. The for/where solution to me is a very costly/bad solution which i didn't really think would be quicker than a built in algorithm.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 09:09:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Performance-of-Cross-table-load-vs-for-loop/m-p/552826#M688034</guid>
      <dc:creator />
      <dc:date>2013-11-21T09:09:52Z</dc:date>
    </item>
  </channel>
</rss>

