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

Performance Join or multiple Selects

sergio_cifuentes
Participant
0 Likes
979

Hi, i want to know in terms of performance, what's better, when you have to make a select for two or more tables what's the best way to do it:

1. Using Join Condition


select *
  from table1
inner join table2
on table1~keyfield = table2~keyfield.

or

2. Using Multiple Select statements


select *
 into itab
from table1
where ....

loop at itab
  select *
    from table2
  where keyfield = itab.keyfield.
endloop.

Thanks.

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
932

Hi there is a seperate forum for Performance and tuning.

Check this

Never use a select inside loop, check yourself through ST05.

5 REPLIES 5
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
933

Hi there is a seperate forum for Performance and tuning.

Check this

Never use a select inside loop, check yourself through ST05.

Read only

Former Member
0 Likes
932

Why not try it yourself and post your results?

The reason being that if anyone bothers to respond, you will get two answers; some will say "1" others will say "2". Then where will you be?

@Keshav.T - but if he asks it in that forum, it would be locked

Rob

Edited by: Rob Burbank on Jan 15, 2010 11:31 AM

Read only

0 Likes
932

Thanks Both, i'm going to make the changes to my code, and try to post the results.

Read only

former_member156446
Active Contributor
0 Likes
932

You can try and get results in Number of micro seconds it took to execute your code if you follow this :

Tr. SM30 > tip & trick button on the top

in the right of the new screen you can see two areas, where you can past/import each of your codes (with and without joins)

once you have pasted/imported your code hit the measure runtime button which will give you the exact result of your code in msec.

Read only

0 Likes
932

>

> You can try and get results in Number of micro seconds it took to execute your code if you follow this :

>

> Tr. SM30 > tip & trick button on the top

>

> in the right of the new screen you can see two areas, where you can past/import each of your codes (with and without joins)

>

> once you have pasted/imported your code hit the measure runtime button which will give you the exact result of your code in msec.

The trouble with this is that buffering will probably be an issue. SAP recommends running this multiple times and taking the lowest from each.

Rob