<?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 join behaviour in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231405#M4152295</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #333333; background: white; font-size: 8.0pt; font-family: 'Arial','sans-serif';"&gt;&lt;A _jive_internal="true" href="https://answers.sap.com/people/lucas.oliveira"&gt;&lt;SPAN style="font-size: 9pt; font-family: inherit, serif; color: #3778c7;"&gt;Lucas Oliveira&lt;/SPAN&gt;&lt;/A&gt;&lt;/STRONG&gt;&lt;SPAN class="apple-converted-space"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;ZRDL_TS_DATE is not a calculated column and no manipulations is done for this field.&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #333333; background: white; font-size: 8.0pt; font-family: 'Arial','sans-serif';"&gt;&lt;A _jive_internal="true" href="https://answers.sap.com/people/fernando.ros"&gt;&lt;SPAN style="font-size: 9pt; font-family: inherit, serif; color: #3778c7;"&gt;Fernando Ros&lt;/SPAN&gt;&lt;/A&gt;&lt;/STRONG&gt;&lt;SPAN class="apple-converted-space"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt; when we filter ZRDL_TS_DATE = '20150401' &lt;STRONG&gt;the push down is happening&lt;/STRONG&gt; (no data is fatched..) . Maybe &amp;lt;= is not supported for push down?&lt;/P&gt;&lt;P&gt; I didn’t understand why a condition like &lt;STRONG&gt;ZRDL_TS_DATE" &amp;lt;= '20150401'&lt;/STRONG&gt;&amp;nbsp; might force to bring more data than without it.&lt;/P&gt;&lt;P&gt;We are in SP97&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Amir &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Aug 2015 04:59:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2015-08-19T04:59:35Z</dc:date>
    <item>
      <title>HANA SQL join behaviour</title>
      <link>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaq-p/11231401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Hello, We have a simple SQL statements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT &lt;/P&gt;&lt;P&gt;Table__24."ZCONTRACT_NO", &lt;/P&gt;&lt;P&gt;Table__111."ACCOUNTING_PRODUCT_GRP_CODE1", &lt;/P&gt;&lt;P&gt;SUM(Table__24."KF_VALUE")&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;"_SYS_BIC"."MD.Groupings/AT_GRP_ACCOUNTING_PRODUCT"&amp;nbsp; Table__111&lt;/P&gt;&lt;P&gt;INNER JOIN "_SYS_BIC"."BNHP-UTILS.NewDrillDown/CV_DAILY_BALANCES"&lt;/P&gt;&lt;P&gt;('PLACEHOLDER' = ('$$IP_BAL_DATE1$$','20150331' ),'PLACEHOLDER' = ('$$IP_MODULE$$', '0')) Table__24&lt;/P&gt;&lt;P&gt;ON (Table__24."_BIC_CACCPRODG" = Table__111."_BIC_CACCPRODG"&amp;nbsp; AND&amp;nbsp; Table__24."ACCOUNTING_PRODUCT_GRP_CODE1" = Table__111."ACCOUNTING_PRODUCT_GRP_CODE1"&amp;nbsp; AND&amp;nbsp; Table__24."ACCOUNTING_PRODUCT_GRP_CODE2" = Table__111."ACCOUNTING_PRODUCT_GRP_CODE2"&amp;nbsp; AND&amp;nbsp; Table__24."ACCOUNTING_PRODUCT_GRP_CODE3" = Table__111."ACCOUNTING_PRODUCT_GRP_CODE3"&amp;nbsp; AND&amp;nbsp; Table__24."ACCOUNTING_PRODUCT_GRP_CODE4" = Table__111."ACCOUNTING_PRODUCT_GRP_CODE4"&amp;nbsp; AND&amp;nbsp; Table__24."ACCOUNTING_PRODUCT_GRP_CODE5" = Table__111."ACCOUNTING_PRODUCT_GRP_CODE5")&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;( Table__24."CURRENCY_TYPE" IN ('G')&amp;nbsp; )&lt;/P&gt;&lt;P&gt;AND&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;nbsp;&amp;nbsp;&amp;nbsp; Table__111."ACCOUNTING_PRODUCT_GRP_CODE1"&amp;nbsp; IN&amp;nbsp; ( '11'&amp;nbsp; )&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; color: #ff0000;"&gt;AND&amp;nbsp; Table__24."ZRDL_TS_DATE" &amp;lt;= '20150401'&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;GROUP BY&lt;/P&gt;&lt;P&gt;Table__24."ZCONTRACT_NO",&lt;/P&gt;&lt;P&gt;Table__111."ACCOUNTING_PRODUCT_GRP_CODE1"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We run this SQL twice: first time with the restriction:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;AND&amp;nbsp; Table__24."ZRDL_TS_DATE"&lt;/STRONG&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;And second time without it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first viso plan:&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/768184" width="450" /&gt;&lt;/P&gt;&lt;P&gt;The second viso plan:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/768215" width="450" /&gt;&lt;/P&gt;&lt;P&gt;As you can see with the restriction of "ZRDL_TS_DATE" the query returns 1,077,662 records and without it the query returns 101,875 records (in both queries we select the same fields…). &lt;/P&gt;&lt;P&gt;Why does it behaves this way? &lt;/P&gt;&lt;P&gt;Isn't it supposed to penetrate our restriction to the lowest level of the calculation view and only return the selected fields? &lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Amir&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 06:26:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaq-p/11231401</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-08-12T06:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: HANA SQL join behaviour</title>
      <link>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231402#M4152292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amir,&lt;/P&gt;&lt;P&gt;No this Where clause restriction is NOT passed to lowest level and restrict the data set. So this is showing as in the explain. You are only passing the IP in one view so it wont restrict for the whole view. Hope you got it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;Chandan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 06:38:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231402#M4152292</guid>
      <dc:creator>chandan_praharaj</dc:creator>
      <dc:date>2015-08-12T06:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: HANA SQL join behaviour</title>
      <link>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231403#M4152293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chandan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;chandan praharaj wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;No this Where clause restriction is NOT passed to lowest level and restrict the data set. &lt;/SPAN&gt;&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;There's no such rule that where will not be passed at lowest level ever, also using input parameters you have a chance to explicit push down but there's no such rule as it depends on your expession and modeling inside the calculation view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="374047" __jive_macro_name="user" class="jive_macro_user jive_macro" data-orig-content="Amir Dror" href="https://community.sap.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It's not clear if the push down is or not possible, anyhow the restriction you want to be pushed down is weak. Perhaps you are forcing him to bring all data to you.&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12px; color: #ff0000; background: #ffffff;"&gt;Table__24."ZRDL_TS_DATE" &amp;lt;= '20150401' &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Sugestion, try to use an exact date on filter and check the result on PlanViz again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess the push down is happening but without it HANA Optimizer can be much better than with your filter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In rare cases the push down is not desired because break the optimizations of Join node. In these cases the best shoot is try in a most recent revision because the optimizer are always being improved and maybe it behave better in a recent revision. BTW: What's yours?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Fernando Da Rós&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 10:53:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231403#M4152293</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-08-12T10:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: HANA SQL join behaviour</title>
      <link>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231404#M4152294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;In addition to what &lt;A __default_attr="2769" __jive_macro_name="user" class="jive_macro_user jive_macro" data-objecttype="3" data-orig-content="Fernando Ros" href="https://community.sap.com/"&gt;&lt;/A&gt; &lt;SPAN style="font-size: 10pt;"&gt;said. Isn't&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="font-size: 12px; color: #ff0000; background: #ffffff;"&gt;ZRDL_TS_DATE &lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;a calculated column? &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;That might explain that behavior. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Using calculated columns in the where clause can force all the values from underlying tables to be retrieved before it can actually perform the calculation and then filter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;BRs,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Lucas de Oliveira&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 12:30:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231404#M4152294</guid>
      <dc:creator>lucas_oliveira</dc:creator>
      <dc:date>2015-08-12T12:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: HANA SQL join behaviour</title>
      <link>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231405#M4152295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #333333; background: white; font-size: 8.0pt; font-family: 'Arial','sans-serif';"&gt;&lt;A _jive_internal="true" href="https://answers.sap.com/people/lucas.oliveira"&gt;&lt;SPAN style="font-size: 9pt; font-family: inherit, serif; color: #3778c7;"&gt;Lucas Oliveira&lt;/SPAN&gt;&lt;/A&gt;&lt;/STRONG&gt;&lt;SPAN class="apple-converted-space"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;ZRDL_TS_DATE is not a calculated column and no manipulations is done for this field.&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #333333; background: white; font-size: 8.0pt; font-family: 'Arial','sans-serif';"&gt;&lt;A _jive_internal="true" href="https://answers.sap.com/people/fernando.ros"&gt;&lt;SPAN style="font-size: 9pt; font-family: inherit, serif; color: #3778c7;"&gt;Fernando Ros&lt;/SPAN&gt;&lt;/A&gt;&lt;/STRONG&gt;&lt;SPAN class="apple-converted-space"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt; when we filter ZRDL_TS_DATE = '20150401' &lt;STRONG&gt;the push down is happening&lt;/STRONG&gt; (no data is fatched..) . Maybe &amp;lt;= is not supported for push down?&lt;/P&gt;&lt;P&gt; I didn’t understand why a condition like &lt;STRONG&gt;ZRDL_TS_DATE" &amp;lt;= '20150401'&lt;/STRONG&gt;&amp;nbsp; might force to bring more data than without it.&lt;/P&gt;&lt;P&gt;We are in SP97&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Amir &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 04:59:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231405#M4152295</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-08-19T04:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: HANA SQL join behaviour</title>
      <link>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231406#M4152296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About bring more data than needed I explain with an issue I faced on SP7 on break of join optimization&lt;SPAN style="font-size: 10pt;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a calc view joinning BKPF and BSEG, which the main filter is BUDAT (date) on BKPF (header) table... and BSEG is acessed after from BKPF date filtering with good performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After add an filter on subsequente projection BSEG-KOART=' ', the behavior changed to run selections in parallel for BSEG with filter KOART=' ' and BKPF with same filter BUDAT to join later. As many rows was acessed from BSEG the performance went down and memory usage increased.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, what should helping to reduce number of rows (KOART) was in fact breaking the join optimization.... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Solution applied at that time was adjuste the expression to (KOART = ' ' or KOART &amp;lt;&amp;gt; '1').. The OR broke the push down and preserved the join optimization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Just to Remember: It happened ON that revision, ON that scenario... HANA DEV are enhancing such optimizers with a lot of inteliggence, so this sample is not needed anymore.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyhow, your case remind me this one and &lt;SPAN style="font-size: 10pt;"&gt;I guess could be happening similar issue. In this case if I have data since 2010, I'll read basically 5 years:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12px; color: #333333; background: #ffffff;"&gt;ZRDL_TS_DATE" &amp;lt;= '20150401'&lt;/STRONG&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Give a try. Perform a test with an expression that broke the push down optimization:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;STRONG style="font-size: 12px; color: #333333; background: #ffffff;"&gt;(ZRDL_TS_DATE" &amp;lt;= '20150401' OR &lt;/STRONG&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&lt;STRONG style="font-size: 12px; color: #333333; background: #ffffff;"&gt;ZRDL_TS_DATE = &lt;STRONG style="font-size: 12px; color: #333333; background: #ffffff;"&gt;ZRDL_TS_DATE&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Fernando Da Rós&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 15:34:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/hana-sql-join-behaviour/qaa-p/11231406#M4152296</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-08-19T15:34:14Z</dc:date>
    </item>
  </channel>
</rss>

