Application Development 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: 

performance issue in select query

Former Member
0 Kudos
140

Moderator message: do not post the same question in two forums. Duplicate (together with answers) deleted.

SELECT a~grant_nbr
        a~zzdonorfy
        a~company_code
        b~language
      b~short_desc
INTO TABLE i_gmgr_text
FROM gmgr AS a
INNER JOIN gmgrtexts AS b ON a~grant_nbr = b~grant_nbr
WHERE a~grant_nbr  IN s_grant
AND   a~zzdonorfy  IN s_dono
AND   b~language   EQ sy-langu
AND   b~short_desc IN s_cont.

How to use for all all entries in the above inner join for better performance?

then....

  IF sy-subrc EQ 0.
    SORT i_gmgr_text BY grant_nbr.
  ENDIF.

  IF i_gmgr_text[] IS NOT INITIAL.

* Actual Line Item Table
    SELECT rgrant_nbr
           gl_sirid
           rbukrs
           rsponsored_class
           refdocnr
           refdocln
    FROM gmia
    INTO TABLE i_gmia
    FOR ALL ENTRIES IN i_gmgr_text
    WHERE rgrant_nbr        = i_gmgr_text-grant_nbr
    AND   rbukrs            = i_gmgr_text-company_code
    AND   rsponsored_class IN s_spon.

    IF sy-subrc EQ 0.
      SORT i_gmia BY refdocnr refdocln.
    ENDIF.

Edited by: Matt on Dec 17, 2008 1:40 PM

1 ACCEPTED SOLUTION

former_member194613
Active Contributor
0 Kudos
97

> As performance point of view innner join is not good. To improve performance you have to made two

> internal table.And make for all entries in the second internal table.like this

please stop writing nonsense recommendations! Did you ever test what you write ... I guess no.

.

5 REPLIES 5

matt
Active Contributor
0 Kudos
97

Do not post the same question in two forums. Do surround your abap with tags.

Now. Why on earth do you think that "for all entries" is better performing that "inner joins".

( and anyone who just posts an answer, rewriting the posters code with "for all entries", will have their reply rejected, unless they justify why their code is better ).

former_member194613
Active Contributor
0 Kudos
97

> How to use for all all entries in the above inner join for better performance?

my best christmas recommendation for performance, simply ignore such recommendations.

And check the performance of your join!

Is the performance really low, if it is then there is probably no index support. Without indexes FOR ALL ENTRIES will be much slower.

Siegfried

Former Member
0 Kudos
97

This message was moderated.

Former Member
0 Kudos
97

As performance point of view innner join is not good. To improve performance you have to made two internal table.And make for all entries in the second internal table.like this

.

former_member194613
Active Contributor
0 Kudos
98

> As performance point of view innner join is not good. To improve performance you have to made two

> internal table.And make for all entries in the second internal table.like this

please stop writing nonsense recommendations! Did you ever test what you write ... I guess no.

.