Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: SAP HANA - Inner Join Performance Optimization

$
0
0

Hi Lars & Sergio,

 

first of all thanks for your input - secondly, sorry about my late response.

 

Requirements has developer a bit since the sql statement i pasted above - as well have an implementation been done - I'm however not satisfied by the performance.

 

The raw SQL is as follows:

SELECT b."BILL_NUM", b."BILL_ITEM", b."BILL_DATE", b."DOC_CURRCY", b."MATERIAL", t."/BIC/TRADE_ID", c."/BIC/CUSHIER6", c."CUST_SALES", b."NETVAL_INV", b."BILL_QTY", c."DATEFROM", c."DATETO"


FROM"/BIC/ANSD300000"AS b


INNERJOIN"/BI0/MCUST_SALES"AS c ON b."SOLD_TO" = c."CUST_SALES"

INNERJOIN"/BIC/MTRADE_ID"AS t ON c."/BIC/CUSHIER6" = t."/BIC/CUSHIER6"


INNERJOIN"/BIC/ANSD260000"as o on b."DOC_NUMBER" = o."DOC_NUMBER"

WHERE b."BILL_TYPE" = 'ZF2'AND 0."DOC_TYPE" = 'ZOR';

 

However it is implented and used in ABAP - in a for all entries statement:

 

 

  IF gi_material IS NOT INITIAL.
    SELECT b~bill_num b~bill_item b~bill_date b~doc_currcy
           b~material
           t~/bic/trade_id c~/bic/cushier6 c~cust_sales
           b~netval_inv b~bill_qty c~datefrom c~dateto
      INTO CORRESPONDING FIELDS OF TABLE lt_temp_table
            FROM /bic/ansd300000 AS b
      INNER JOIN /bi0/mcust_sales AS c
      ON b~sold_to EQ c~cust_sales
      INNER JOIN /bic/mtrade_id AS t
      ON c~/bic/cushier6 = t~/bic/cushier6
      INNER JOIN /bic/ansd260000 as o
      on b~doc_number EQ o~doc_number
      FOR ALL ENTRIES IN gi_material
      WHERE t~/bic/trade_id EQ gi_material-tradeid AND
            b~bill_type EQ 'ZF2' AND
            o~doc_type EQ 'ZOR' AND
            b~material EQ gi_material-material AND
            c~dateto GE gi_material-date1 AND
            b~bill_date LE gi_material-date1.
  ENDIF.

 

for 25000 records in gi_material the execution time for the for all entries statement is 3-4 min. Over time that will increase if nothing is done as we get more and more data into those tables.

 

I would like to minimize the execution time as the program is running every 5 min.

 

The HANA revision in use is 85.02. It is on a scale-out platform running BW on HANA, hence the big DSO tables (/BIC/A*00) are partitioned using HASH partitioning (hence standard partitioning in BW on HANA).

 

The explain plan for the raw SQL is as follows:

sql_explain_plan.JPG

 

The virtualized plan (prepared) looks as follows:

virtualized_prepared_plan_high_level.JPG

Details for the high cost part:

virtualized_prepared_plan.png

 

Any idea on how I can optimize? (create the stuff in views instead and consume that given view as a DDIC object in ABAP? utilize CDS views? etc)

 

 

Thanks in advance. KR

Torben


Viewing all articles
Browse latest Browse all 9165

Trending Articles



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