‎2008 Mar 05 6:41 AM
Hi Guys,
I am doing analysis on Performance improvement. when we are using JOINS is it better to use short alias name or Long alias name.
Surprisingly i am getting better performance for long alias name. resulting time is the average of 100 executions.
Please check below code.
TYPES: Begin of t_vbrk,
vbeln TYPE vbrk-vbeln,
fkart TYPE vbrk-fkart,
vbtyp TYPE vbrk-vbtyp,
vkorg TYPE vbrk-vkorg,
erdat TYPE vbrk-erdat,
zuonr TYPE vbrk-zuonr,
posnr TYPE vbrp-posnr,
meins TYPE vbrp-meins,
fklmg TYPE vbrp-fklmg,
ntgew TYPE vbrp-ntgew,
gewei TYPE vbrp-gewei,
matnr TYPE vbrp-matnr,
vkbur TYPE vbrp-vkbur,
END OF t_vbrk.
DATA: i_vbrk TYPE STANDARD TABLE OF t_vbrk,
w_before TYPE i,
w_after TYPE i,
w_delta TYPE i.
GET RUN TIME FIELD w_before.
SELECT vbrkvbeln vbrkfkart vbrkvbtyp vbrkvkorg
vbrkerdat vbrkzuonr vbrpposnr vbrpmeins
vbrpfklmg vbrpntgew vbrpgewei vbrpmatnr
vbrp~vkbur
INTO TABLE i_vbrk
FROM vbrk AS vbrk INNER JOIN vbrp AS vbrp
ON vbrkvbeln EQ vbrpvbeln
WHERE vbrk~vbeln LT '0005021899'.
GET RUN TIME FIELD w_after.
w_delta = ( w_after - w_before ) / 100000.
WRITE:/1 'With Long alias name', w_delta.
CLEAR: w_before, w_after, w_delta.
GET RUN TIME FIELD w_before.
SELECT avbeln afkart avbtyp avkorg
aerdat azuonr bposnr bmeins
bfklmg bntgew bgewei bmatnr b~vkbur
INTO TABLE i_vbrk
FROM vbrk AS a INNER JOIN vbrp AS b
ON avbeln EQ bvbeln
WHERE a~vbeln LT '0005021899'.
GET RUN TIME FIELD w_after.
w_delta = ( w_after - w_before ) / 100000.
WRITE:/1 'With short alias name', w_delta.
Even i tried interchanging the position of the select statements.
This select will fetch around 24000+ records in my system.
Please suggest whether this is the right way to do the performance analysis.
Thanks,
Vinod.
‎2008 Mar 05 6:47 AM
Hi,
If u want to improve the performance of the program then use for all entries instead of joins, bezc joins reduces the speed of retiveing the data from the Database.
In ur query u used alias, it is used for only to reduce the code length, instead of repeting the same word more no. of times, i thing its nothing related to perfomance.You try with FORALL ENTRIES.
Regards,
kavitha.
‎2008 Mar 05 6:47 AM
Hi,
If u want to improve the performance of the program then use for all entries instead of joins, bezc joins reduces the speed of retiveing the data from the Database.
In ur query u used alias, it is used for only to reduce the code length, instead of repeting the same word more no. of times, i thing its nothing related to perfomance.You try with FORALL ENTRIES.
Regards,
kavitha.
‎2008 Mar 05 6:50 AM
Hi,
In the first query, if u use the same alias name as the table name , there is no need of extension 'as vbrk' . It can be given as 'from vbrk join vbrp on' condn.
Regards,
Ramya
‎2008 Mar 05 6:53 AM
Hi,
But this has got nothing to do with the performance. Check if u can reduce the selection time. Use 'for all entries'. Make sure that u check if the itab is not initial before using 'for all entries in itab'.
Regards,
Ramya
‎2008 Apr 16 7:34 AM