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

JOIN Alias name.

vinod_vemuru2
Active Contributor
0 Likes
665

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
636

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.

4 REPLIES 4
Read only

Former Member
0 Likes
637

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.

Read only

Former Member
0 Likes
636

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

Read only

Former Member
0 Likes
636

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

Read only

vinod_vemuru2
Active Contributor
0 Likes
636

Thank u guys