‎2010 Jan 15 4:21 PM
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.
‎2010 Jan 15 4:28 PM
Hi there is a seperate forum for Performance and tuning.
Check this
Never use a select inside loop, check yourself through ST05.
‎2010 Jan 15 4:28 PM
Hi there is a seperate forum for Performance and tuning.
Check this
Never use a select inside loop, check yourself through ST05.
‎2010 Jan 15 4:29 PM
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
‎2010 Jan 15 4:50 PM
Thanks Both, i'm going to make the changes to my code, and try to post the results.
‎2010 Jan 15 4:55 PM
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.
‎2010 Jan 15 5:03 PM
>
> 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