Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

SQL- Inner select performance

$
0
0

Hello everyone,

 

At a customer, we are currently trying out Cognos reporting on SAP HANA views. Currently, they are using Cognos reporting on Bex Queries (BW on HANA), and we are hoping for an improvement in performance by using HANA views.

 

Unfortunately, performance is not very impressive when the Cognos environment consumes our HANA view.

 

When analyzing,we noticed that Cognos is sending the SQL statement below to HANA. I'm coming from an SAP BW background and am still improving SQL-wise.

 

The SQL is as follows:

 

SELECT

    SUM("HANAview"."KEYFIFGURE"),

    "HANAview"."FIELD_1",

    "HANAview"."FIELD_2"

FROM

    (

     Select   * from  "_SYS_BIC"."HANAview" ('PLACEHOLDER'=('$$IP_CURRENCY$$','EUR'))

    ) "HANAview"

WHERE

    NOT ( "HANAview"."0COMP_CODE" IS NULL ) AND

    "HANAview"."0COMP_CODE" <> '6460' AND

    "HANAview"."0FISCPER" >= '2015001' AND

    "HANAview"."0FISCPER" <= '2015005'

GROUP BY

    "HANAview"."FIELD_1",

    "HANAview"."FIELD_2"

 

So the Cognos report creates a statement with an inner SELECT that, if executed by itself, would retrieve all data from the view.

 

Indeed, if I rewrite this statement so that there is no inner SELECT, I get a much better response time (15 times faster).

 

My question is if the inner select will be executed first, independently of the outer select, and the system thus retrieves all data from the view before applying the restrictions of the outer select.

 

My test seems to indicate that this is the case, but when I read documentation on this, I sometimes find that the SQL optimizer determines the most efficient way of executing a statement. So I would expect it would be able to deal with this better.

 

Can anybody give me some certainty on this?

 

Thanks !


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>