<?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>Question Re: HANA SQL slow when selecting timestamp in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/hana-sql-slow-when-selecting-timestamp/qaa-p/371270#M28654</link>
    <description>&lt;P&gt;In the meantime I went deeper into the selection hierarchy and found a lower level where there are aggregations on the timestamp fields&lt;/P&gt;&lt;P&gt;When leaving these aggregations out the performance increases greatly. However the aggregations seem to be required to get the correct result.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT 
        PRODUCT.PRODUCT_CODE AS MATERIALNUMBER,
        ASSORTMENT.USER_ID AS CUSTOMERNUMBER,
        MIN( LIFECYCLE.ORDERFROMDATE ) AS ORDERFROMDATE,
 	MAX( LIFECYCLE.PHASEOUTDATE ) AS PHASEOUTDATE,
 	MAX( LIFECYCLE.DROPDATE ) AS DROPDATE,
 	PRODUCT.IS_ACCESSORY AS ISACCESSORY
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 Feb 2017 09:08:12 GMT</pubDate>
    <dc:creator>Joery</dc:creator>
    <dc:date>2017-02-13T09:08:12Z</dc:date>
    <item>
      <title>HANA SQL slow when selecting timestamp</title>
      <link>https://community.sap.com/t5/technology-q-a/hana-sql-slow-when-selecting-timestamp/qaq-p/371269</link>
      <description>&lt;P&gt;Dear HANA enthusiasts,&lt;/P&gt;&lt;P&gt;I am getting more and more familiar with native HANA developments and the best practices for it due to the many blogs and useful answers to some questions asked before.&lt;/P&gt;&lt;P&gt;Here we are again and this time everything is working correctly with limited data but very slow when using more data. When using a lot of data the query that is executed will even drain all system resources. After analysis of the logic I noticed some strange behaviors.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The queries seem to be sowed down when using 'UNION' in SQL scripts or table functions instead of 'FULL OUTER JOIN' with the same behavior (yes I started using table functions instead of Scripted views &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; )&lt;/LI&gt;&lt;LI&gt;When selecting a TIMESTAMP field the execution time rises drastically.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I have reworked my resulting view (which has a lot of hierarchically structured subviews) into a smal sample that can be executed in a single SQL statement. &lt;/P&gt;&lt;P&gt;When executing this and not taking the timestamp field into account the execution time is about 2 seconds for about 12000 records.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/19886-2017-02-10-18-29-28-sap-hana-development-c-program.png" /&gt;&lt;/P&gt;&lt;P&gt;Then when also taking the timestamp into consideration it takes about 1minute 20seconds for the same amount of data. &lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/19887-2017-02-10-18-51-05-sap-hana-development-c-program.png" /&gt;&lt;/P&gt;&lt;P&gt;Like this it is not usable since in the end on a real system there will be 1000 or more times the amount of records. And as far as I am aware HANA should not have any trouble with this.&lt;/P&gt;&lt;P&gt;Additionally I also tried to remove one of the NVARCHAR(255) fields while leaving out the timestamp as well and the difference is marginal.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/19888-2017-02-10-18-56-58-sap-hana-development-c-program.png" /&gt;&lt;/P&gt;&lt;P&gt;And for the sake of completeness I also want to add that we are currently working on HANA revision 97.00.&lt;/P&gt;&lt;P&gt;Did anyone have similar experience or possibly know a solution for this abnormal slowdown?&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Joery&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 18:04:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/hana-sql-slow-when-selecting-timestamp/qaq-p/371269</guid>
      <dc:creator>Joery</dc:creator>
      <dc:date>2017-02-10T18:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: HANA SQL slow when selecting timestamp</title>
      <link>https://community.sap.com/t5/technology-q-a/hana-sql-slow-when-selecting-timestamp/qaa-p/371270#M28654</link>
      <description>&lt;P&gt;In the meantime I went deeper into the selection hierarchy and found a lower level where there are aggregations on the timestamp fields&lt;/P&gt;&lt;P&gt;When leaving these aggregations out the performance increases greatly. However the aggregations seem to be required to get the correct result.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT 
        PRODUCT.PRODUCT_CODE AS MATERIALNUMBER,
        ASSORTMENT.USER_ID AS CUSTOMERNUMBER,
        MIN( LIFECYCLE.ORDERFROMDATE ) AS ORDERFROMDATE,
 	MAX( LIFECYCLE.PHASEOUTDATE ) AS PHASEOUTDATE,
 	MAX( LIFECYCLE.DROPDATE ) AS DROPDATE,
 	PRODUCT.IS_ACCESSORY AS ISACCESSORY
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Feb 2017 09:08:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/hana-sql-slow-when-selecting-timestamp/qaa-p/371270#M28654</guid>
      <dc:creator>Joery</dc:creator>
      <dc:date>2017-02-13T09:08:12Z</dc:date>
    </item>
  </channel>
</rss>

