2014 Apr 07 9:04 AM
Hi all,
Is internal table processing faster in AMDP?
Context :
We have abap code which is currently taking up ~80% of execution time.
When analyzed we see it's all looping into internal tables in abap. Calculating and updating the same internal tables.
Is it a good idea to do these calculations in AMDP ? Will that give us any benifit ? i doubt...
2014 Apr 07 9:23 AM
Hi,
depending on your application use case it might make sense to do a code-pushdown, i.e. use an AMDP.
Let me explain "depending" in two small/bold examples:
1. You have a lot of data. You fetch it from the DB into an internal table, you do a lot of calculations on the data (maybe even followed by certain aggregations), and finally you finally persist the data back on the DB or you only display a small number of records on a UI. In this example, an AMDP certainly is worth the effort.
2. You have a lot of data (or you don't have a lot of data ) and you need the data on the application server - you didn't fetch it from the DB just do calculations (as was the case in the previous example). After your calculations you need to transfer the data further to another application (e.g. you pass the internal table) or you want to display all data on the UI. In this example, you wouldn't benefit that much from an AMDP.
So it really depends on your application/development scenario. But it's a priori not just faster to use DB temporary tables in AMDPs instead of working with internal tables.
Cheers,
Jasmin
Hi all,
Is internal table processing faster in AMDP?
Context :
We have abap code which is currently taking up ~80% of execution time.
When analyzed we see it's all looping into internal tables in abap. Calculating and updating the same internal tables.
Is it a good idea to do these calculations in AMDP ? Will that give us any benifit ? i doubt...
2014 Apr 07 9:23 AM
Hi,
depending on your application use case it might make sense to do a code-pushdown, i.e. use an AMDP.
Let me explain "depending" in two small/bold examples:
1. You have a lot of data. You fetch it from the DB into an internal table, you do a lot of calculations on the data (maybe even followed by certain aggregations), and finally you finally persist the data back on the DB or you only display a small number of records on a UI. In this example, an AMDP certainly is worth the effort.
2. You have a lot of data (or you don't have a lot of data ) and you need the data on the application server - you didn't fetch it from the DB just do calculations (as was the case in the previous example). After your calculations you need to transfer the data further to another application (e.g. you pass the internal table) or you want to display all data on the UI. In this example, you wouldn't benefit that much from an AMDP.
So it really depends on your application/development scenario. But it's a priori not just faster to use DB temporary tables in AMDPs instead of working with internal tables.
Cheers,
Jasmin
2014 Apr 10 4:52 PM
In ABAP you can't use select statement to an internal table. Which means many alternate operations can be done on HANA side easily. May be you can split data into different table's based on logic and using ROW / COLUMN table types, aggregations, CE functions, sub queries you can do it faster i believe.
( I made similar thing so that i am giving those examples )
and doing something on HANA is very cool ehehe
2014 Apr 15 7:09 AM
Hi Bilen,
short clarification on your last reply: in ABAP you can of course use internal tables, in your previous reply I think you meant that you cannot use internal tables in AMDPs . The reason is that an internal table is an ABAP object/artefact, which you can only pass to an AMDP by value (not by reference). The content of the ABAP's internal table inside the AMDP (or in other words in the HANA database) is transferred to a temporary table on which operations like SELECT, etc. can be performed.
Cheers,
Jasmin
2014 Apr 15 7:25 AM
Hi,
Thanks you both for your inputs.
I have another related query :
There are huge records in internal table , so when we give the control to AMDP-HANA ,
from ABAP these records are copied to HANA layer and again after AMDP works the records are written back to ABAP layer .
I hope this overhead doesn't hamper the performance gains done in AMDP. What do you say?
Thanks,
Maq
2014 Apr 15 8:28 AM
Hi Maqsood,
if I understand correctly, you have an application logic which selects a huge amount of data from the DB into an internal table, you then do calculations/logic, and finally pass (let's say without any further aggregation) the internal table to another application layer or some other logical processing unit.
In this case I don't think you will gain anything from code-pushdown to the database.
Let me, in a very simplified way, describe a performance gain scenario: You have a lot of data (say 1M records and several columns) and you do some calculation/aggregation/logic on that data, you then only need a reduced number of records and/or columns on the application server layer, e.g. for further passing the data to a user interface. In this case you you can gain performance when doing the logic on the database.
However, if I understand correctly, you already have (or had) to pull the data to the App server layer and you would like to transfer the data back to the DB layer for further processing and then transfer the data back to the ABAP - this means you transfer the data 3 times (DB to AS, from AS back to DB, and again DB to AS)... while your alternative would be to do the data transfer from DB to AS and do all the calculations on the application server.
But, think one step further, can't you e.g. change the application logic in a way that you don't do the first transfer of the huge amount of data from the DB to the AS, i.e. you already do code-pushdown in the first step? In this case you don't have the data in the internal table and move it to the DB and back to the AS... Might be an option for you but of course this depends on the whole application logic.
Cheers,
Jasmin
2016 May 09 12:09 PM
Hi,
I have a use case where I have to loop at a SELECT statement to traverse to the root entry. Which is better in this case: AMDP in a table function or ABAP ?
Thanks,
Shalini