05-22-2008 9:20 AM
Hi guys i have an ABAP report which shows 80 % time for the database. i dont have much idea in improving the perofrmance of the report. Please help me how to improve the perofrmance of a program as i am a beginner...
Thanks,
Sanu
05-22-2008 9:56 AM
Hi Sanu,
Your question is very generic, I think that you have performed a run-time analysis of your program and it says that your program spends 80% of the time in the database.
- Browse around a bit in the run time analysis, go to the Hit list for instance. It will show you how much time each step takes. Look in the Net column, that will show you which part is taking the most time.
Then follow these three "golden rules" for efficient database handling in ABAP programs:
Minimise amount of data accessed by the SQL statement.
- Make sure all select-statements have WHERE clauses.
- Use well defined WHERE statements, always have values for the key-field(s) or one of the index fields.
Minimise data transfer from database to application servers.
- Define a field list, instead of SELECT * (star) statements.
Minimise the number of data transfers from database to apllication servers.
- SELECT INTO table.
- Use FOR ALL ENTRIES in table, instead of nested selects or selects inside LOOPS.
Use the F1 help on the Select-statement that will show you how to write the options described above.
I'm aware that this is not a very concrete answer, it requires quite a bit of work on your part, but I hope this will put you on path towards learning how to program in a performant way.
Regards,
Stefan Ericsson
05-22-2008 9:56 AM
Hi Sanu,
Since you are a beginner, I would like you to refer these links which might help you to improve the performance of the code.
Run Time Analyser
http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm
SQL trace
http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm
And also, try these links.
SE30
/people/siegfried.boes/blog/2007/11/13/the-abap-runtime-trace-se30--quick-and-easy
maybe also interesting SQL trace:
/people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy
Hope this is helpful to you. If you need further information, revert back.
Reward all the helpful answers.
Regards
Nagaraj T
05-22-2008 9:56 AM
Hi Sanu,
Your question is very generic, I think that you have performed a run-time analysis of your program and it says that your program spends 80% of the time in the database.
- Browse around a bit in the run time analysis, go to the Hit list for instance. It will show you how much time each step takes. Look in the Net column, that will show you which part is taking the most time.
Then follow these three "golden rules" for efficient database handling in ABAP programs:
Minimise amount of data accessed by the SQL statement.
- Make sure all select-statements have WHERE clauses.
- Use well defined WHERE statements, always have values for the key-field(s) or one of the index fields.
Minimise data transfer from database to application servers.
- Define a field list, instead of SELECT * (star) statements.
Minimise the number of data transfers from database to apllication servers.
- SELECT INTO table.
- Use FOR ALL ENTRIES in table, instead of nested selects or selects inside LOOPS.
Use the F1 help on the Select-statement that will show you how to write the options described above.
I'm aware that this is not a very concrete answer, it requires quite a bit of work on your part, but I hope this will put you on path towards learning how to program in a performant way.
Regards,
Stefan Ericsson
05-22-2008 9:56 AM
Hi,
run your program through SE30. u can go thru this link to know abt [se30|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/7769] [original link is broken] [original link is broken] [original link is broken];
other performance tuning tips:
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/abap%2bperformance%2band%2btuning
regards,
madhumitha
05-22-2008 2:55 PM
Hello,
I would suggest you to switch on ST05 trace before running this report. There you have options of finding the expensive sql statement. Basically you have to tune this expensive sql statement. Following are the things you have to check mainly
1. WHERE clause of the sql statement
2. Whether the fields in the WHERE clause is mentioned in the index accessed , if not create proper index. You can check the selectivity of the fields through DB05 transaction.
3. Make sure statistics are upto date for all table/indexes accessed.
4. Check for the index fragmentation.
Yours Sincerely
Dileep
05-23-2008 7:24 AM
if you know already that your program spends 80% on the database, then you have 80% improvement potential on the database.
Please read my blog on the SQL Trace which was mentioned above already. Read it carefully, to find the point where you should start on the
database is very simple.
Go to the SQL statement summary, the are sorted by duration,
1. check 'min time/records' => slow then check indexes.
2. Check number of executions and records, if high, try to reduce, there is probably to much going
3. heck buffer column
4. identicals
But the nuimber 1. is the most important, maybe you have on bug, which makes on select very slow.
Please, never forget, do not trace the first execution but the second or third! Check whether your 80% are based on a first execution or not.
Siegfried
05-26-2008 10:38 AM
make sure
u using select single it use database buffer.
try to use field group in ur program if u dont knw read them..
always use internal table of temp update .
05-27-2008 9:34 AM
Hi Malay Gal..
R u a Melayu Girl from Malaysia....
Regards,
sg
05-27-2008 9:20 AM
Hi
go to tcode se30
clik on tips & tricks on the application tool bar
then in the left hand side of the screen u find no of folders
just clik on
selec* vs selct f1,f2.....
just double clik on it then clik on measure run time
so that u 'll get which code is taking how much time
if it takes less time meansit's performance is better
so in any program u ve to modify the statement's acordingly so that
ur program will takes very less execution time .
just go through it
in this process u just try and chechk which types of code u've written and how that can be replaced..
reward if useful
sachhidananda