2014 Oct 23 10:47 AM
Hello Experts,
I have attached my code for your reference. I have used too many select query and nested loop. I am still new to development, could you please look into my program and tell me how can I reduce database access, when i checked with SE30(run time analysis)
i got the below graph:
ABAP = 3.3
DATABASE = 97
SYSTEM = 0
The program will run in background. Could you please suggest how can i reduce the database graph??
Thanks in advance,
Sarnava.
2014 Oct 23 11:41 AM
2014 Oct 23 11:50 AM
Hello Christian,
Thanks for your reply, but we don't have access to SAT transaction.
Regards,
Sarnava
2014 Oct 23 11:53 AM
2014 Oct 23 11:55 AM
sarnava bose wrote:
but we don't have access to SAT transaction.
Then you should ask for it. I don't see any reason why a developer should not have access to SAT.
2014 Oct 23 11:53 AM
Hi,
Actually Its better for you to optimize the code based on some of the performance tuning methods , Rather than we are doing and giving,
Please Follow the below mentioned steps,
1. Try to fetch the data from table based on the primary index. This is the most fastest way for fetching data.
Primary index comprises all the key fields of the corresponding table.So in where condition try to use all these fields.
2. Try to avoid using more conditions in where clause as it creates load for database optimizer.
3. Try to avoid select inside loop.
4. Use Joins / For all entries for fetching data from related tables rather than using nested selects.
5. Avoid using select *.
6. Avoid using into corresponding fields.
7. Avoid using operators like < , > ,<= etc if possible.
8. Before using for all entries, Check the Reference internal table is initial or not.
Go to se30 and execute the report, Then take the report and find out which select statement is taking more time and try to optimize that select statement by above methods, Do the same for all select statement and try to bring down database utilization from 97 to less than 50 always.
There are lot of documents available for performance tuning, Please go through that documents for more information.
Thanks and Regards,
Sajeesh
2014 Oct 23 11:57 AM
2. Try to avoid using more conditions in where clause as it creates load for database optimizer.
6. Avoid using into corresponding fields.
Where did you get these fads from? Get your facts correct before posting.
2014 Oct 23 12:09 PM
Sorry for that, Actually i didn't meant that not to use more where where condition in the select statement, Just meant, to avoid unwanted comparisons and all that makes the Fetching process bit more time consuming.
2014 Oct 23 12:23 PM
Hi sarnava,
Sorry for making my reply bit confusing.
The second point which i gave in my first reply was,
2. Try to avoid using more conditions in where clause as it creates load for database optimizer.
Please consider it as ,
Try to avoid " unwanted " comparison and other condition which could increase the fetching time.
And the point that i have mentioned above cannot be implemented everywhere , But try to use that if possible based on the input data we are getting.
Regarding the 6th point,
6.Try to avoid " into corresponding " clause if possible, Instead of this directly specify the the table or work area having similar structure as of selecting data.
Regards,
sajeesh
2014 Oct 23 12:49 PM
6.Try to avoid " into corresponding " clause if possible, Instead of this directly specify the the table or work area having similar structure as of selecting data.It's wrong as well. Search in the forums for a blog about INTO CORRESPONDING.
2014 Oct 23 12:58 PM
Hi,
I went through the following blogs and it explains the use of " into corresponding " clause.
But in some blog it is showing that to avoid using "into corresponding".
ABAP Performance tips - Contributor Corner - SCN Wiki
Thanks and regards,
sajeesh
2014 Oct 23 1:14 PM
The former is with facts, while the latter is without. Which is more credible?
Anyway i think the OP should perform some trace on his code and then get back to the forums with his results. Until then the thread remains closed.
2014 Oct 23 1:09 PM
Hi sarnava,
Please go to the following blog which explains most of the performance tuning tricks.
ABAP Performance tips - Contributor Corner - SCN Wiki
Regards,
sajeesh