Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

fine tuning the database query

Former Member
0 Likes
819

To analyse the load of a particular object. we do use 'performance analysis' in ABAP. But let us suppose we've come to know that more load is on the database. i.e. suppose 80% on database, 20% on Application server. what could be the possible steps that u wud perform on the query so that the load gets decreased. we don't have a chance to transform the load from database to application server (such as using internal tables and hence reducing the load). we should do something on the database side. so what can we do. any solution would be highly appreciated.

thanks in advance for the solution.

To analyse the load of a particular object. we do use 'performance analysis' in ABAP. But let us suppose we've come to know that more load is on the database. i.e. suppose 80% on database, 20% on Application server. what could be the possible steps that u wud perform on the query so that the load gets decreased. we don't have a chance to transform the load from database to application server (such as using internal tables and hence reducing the load). we should do something on the database side. so what can we do. any solution would be highly appreciated.

thanks in advance for the solution.

6 REPLIES 6
Read only

suresh_datti
Active Contributor
0 Likes
800

Hi Kiran,

One option could be to use an INDEX on the table..

Regards,

Suresh Datti

Read only

Former Member
0 Likes
800

Hi Kiran,

Yes, You can reduce the load on the Database by better use of internal tables.

Avoid Selects in loops.

Avoid Nested Selects and instead use For all entries stataments.

Avoid Select-endselect statements instead use, Select into table type of statements.

For more info,

/message/1161039#1161039 [original link is broken]

Regards,

Ravi

Read only

Former Member
0 Likes
800

Hi,

You should use ST05 and then Switch TRACE ON for SQL.

Then do your query again.

After you have run your query, you switch the trace OFF and then you display the trace.

When displaying the trace you can see which SQL queries that have been made and how long time they have taken (left most column).

If the time is RED that indicates a bad query.

Anyway. Doubleclick on the query to find out how the query is made.

And analyse the table(s) that are used and whether or not an INDEX is used.

If no index is used you can ADD an index to the database table(s) in transaction SE10. Or directly in the database if you have that possibilty.

ST05,

Trace on,

Run query,

Trace off,

Display trace,

Analyze trace.

Good luck!

BR Mattias

Read only

Former Member
0 Likes
800

Hi Kiran,

Few points:

1) Try to put less no. of select Queries in the prog.

2) Avoid repeating select query on to the same program.

3) Try to use select single instead of select *.

4) Use read inside a loop with binary search instead of using select inside a loop.

and lot more but at this amount of time following above steps will surely readuce the database loads.

Cheers

Sunny

Rewrd points, if found helpful

Read only

Former Member
0 Likes
800

hi kiran,

The pdf below briefs how to improve and tune performance in ABAP...

http://www.sappoint.com/faq/faqsql.pdf

Also check...

http://www.sapgenie.com/abap/performance.htm

Hope it helps...

Regs,

jaga

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
800

Hi,

Whatever values you need from a datatable,get it using a single select statement rather than using select inside loop...endloop.

Put all the necessary data in internal table at a stretch from database and then use read or loop statements to process the data from internal table.