Skip to Content
0
Former Member
Aug 12, 2015 at 06:26 AM

HANA SQL join behaviour

217 Views

Hello,

Hello, We have a simple SQL statements:

SELECT

Table__24."ZCONTRACT_NO",

Table__111."ACCOUNTING_PRODUCT_GRP_CODE1",

SUM(Table__24."KF_VALUE")

FROM

"_SYS_BIC"."MD.Groupings/AT_GRP_ACCOUNTING_PRODUCT" Table__111

INNER JOIN "_SYS_BIC"."BNHP-UTILS.NewDrillDown/CV_DAILY_BALANCES"

('PLACEHOLDER' = ('$$IP_BAL_DATE1$$','20150331' ),'PLACEHOLDER' = ('$$IP_MODULE$$', '0')) Table__24

ON (Table__24."_BIC_CACCPRODG" = Table__111."_BIC_CACCPRODG" AND Table__24."ACCOUNTING_PRODUCT_GRP_CODE1" = Table__111."ACCOUNTING_PRODUCT_GRP_CODE1" AND Table__24."ACCOUNTING_PRODUCT_GRP_CODE2" = Table__111."ACCOUNTING_PRODUCT_GRP_CODE2" AND Table__24."ACCOUNTING_PRODUCT_GRP_CODE3" = Table__111."ACCOUNTING_PRODUCT_GRP_CODE3" AND Table__24."ACCOUNTING_PRODUCT_GRP_CODE4" = Table__111."ACCOUNTING_PRODUCT_GRP_CODE4" AND Table__24."ACCOUNTING_PRODUCT_GRP_CODE5" = Table__111."ACCOUNTING_PRODUCT_GRP_CODE5")

WHERE

( Table__24."CURRENCY_TYPE" IN ('G') )

AND ( Table__111."ACCOUNTING_PRODUCT_GRP_CODE1" IN ( '11' )

AND Table__24."ZRDL_TS_DATE" <= '20150401'

)

GROUP BY

Table__24."ZCONTRACT_NO",

Table__111."ACCOUNTING_PRODUCT_GRP_CODE1"

We run this SQL twice: first time with the restriction:

AND Table__24."ZRDL_TS_DATE"

And second time without it.

The first viso plan:

The second viso plan:

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…).

Why does it behaves this way?

Isn't it supposed to penetrate our restriction to the lowest level of the calculation view and only return the selected fields?

Thanks,

Amir

Attachments

viso1.jpg (54.3 kB)
viso2.jpg (69.9 kB)