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 issue with select statement

Former Member
0 Likes
1,096

Hi Experts,

I have a select statement with inner join and for all entries.

Eg : it_data has 50,000 records.

while sy-subrc eq 0.

select a~field1 a~field2 a~field3 a~field4

          b~field1 b~field2 b~field3 into table it_temp

         from Zxxxxx as a inner join Zyyyyyy as b

        on a~field1 eq b~field1

for all entries in it_data where a~field1 in s_field1

and a~field2 in s_field2 and b~field3 = it_data-field5.

endwhile.

Note: Zxxxxx has 10000 records and Zyyyyyy has 4000 records.

Problem : taking long time for execution. its a performance issue.

3doubts: 1) Can I use for all entries with inner joins with huge data.

             2) I want to replace for all entries with Ranges..............with huge data...............is it work.

             3) What about While.....endwhile loop............?

Please Suggest me.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

PeterJonker
Active Contributor
0 Likes
1,056

It will  definitely have a performance issue: IT WILL RUN FOREVER !!

WHILE .

ENDWHILE.

and no exit condition. If your select has a result it will continue to do the same select over and over again.

You can call that a performance problem, I would call it different, but I will not mention it on this forum.

7 REPLIES 7
Read only

ceedee666
SAP Champion
SAP Champion
0 Likes
1,056

Hi,

where do the 50000 entries in your itab come from? Most likely also a select statement.

if this is the case why don't you try to use a join of the three tables involved instead of the join together with for all entries?

Christian

Read only

Former Member
0 Likes
1,056

Hi Nagireddy.

1. I think if you are using table keys for Zxxxxx and Zyyyyyy, it's ok.

2. You can insert 50,000 in a range. the limit of the database is approximately 5,000.

3. I do not understand to make a selection within a loop. also if the select returns data you enter an infinite loop. As I see that's the problem.

Regards,

Genaro.

Read only

NooruBohra
Active Participant
0 Likes
1,056

Hi,

Do not use WHILE----ENDWHILE Instead you can use IF---ENDIF

WHILE--ENDWHILE will be an endless loop if the query executed successfully and fetch some records.

Regards,

Nooruddin Bohra

Read only

former_member201275
Active Contributor
0 Likes
1,056

No idea why you have this WHILE statement here!?

Read only

nikolayevstigneev
Contributor
0 Likes
1,056

Hi,

Read only

Former Member
0 Likes
1,056

Hi,

First check the secondary Indexes of the tables if the index is not there create secondary index and try.

i suggest with for all entries using in inner join better to avoid.


Read only

PeterJonker
Active Contributor
0 Likes
1,057

It will  definitely have a performance issue: IT WILL RUN FOREVER !!

WHILE .

ENDWHILE.

and no exit condition. If your select has a result it will continue to do the same select over and over again.

You can call that a performance problem, I would call it different, but I will not mention it on this forum.