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

select

Former Member
0 Likes
479

Just check the 2 select statements below.

1.select * from lfa1 into table itab where .....

2.select * from lfa1 into itab where .....

append itab.

endselect.

In the both cases which one is preferrablein terms of performance and what is the Reason for that.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
457

Hi Sandeep,

the first 1 is good.

Bcoz the second one puts a hit on the database table in a loop.

thus reducing the performance timing.

Awrd points if found useful

4 REPLIES 4
Read only

Former Member
0 Likes
458

Hi Sandeep,

the first 1 is good.

Bcoz the second one puts a hit on the database table in a loop.

thus reducing the performance timing.

Awrd points if found useful

Read only

Former Member
0 Likes
457

First one.

Since in second, the Database hit each and everytime. It's like writing a select query in a loop.

Regards

Nishant

Read only

meikandan_krishnan2
Participant
0 Likes
457

hi ,

<b>Statement 1.</b>

Based on the where condition , records from LFA1 table will be retrieved and saved to the internal table directly in a single process. In this case database hit is very less , we can say a single hit.

<b>

Statement 2.</b>

The controls checks each and every record based on the where condition . If the record found , it goes inside the loop and append to the internal table.

Here the database hits are more . Also the append statement on each sucessful conditions decrease the performance.

Conclusion :

Its better to use "into table" , ie the statement 1.

Have a nice day.

Regards

Meikandan.

Read only

Former Member
0 Likes
457

hi sandeep,

the first one is a better option to use because if the where condition is matched it directly get's all the values from lfa1 to itab but in the second case the query is executed every time the where condition is true it fetches from the db and appends it to the internal table.

so in the second case the performance is not as gud as in the 1st case.

regards,

sohi