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...endselect performance

Former Member
0 Likes
2,387

Hello,

Does anyone has a documentation about cause of low performance of select ... endselect statement.

Thanks in advance,

Roy.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,104

hi ofir kadosh,

Check these links...

1.

3.

5.

Hope this helps you.

Regards,

Maheswaran.B

9 REPLIES 9
Read only

abdul_hakim
Active Contributor
0 Likes
1,104

Hi

Select Endselect will give worse perfomance instead use SELECT..INTO TABLE addition.

Thanks,

Abdul

Read only

Former Member
0 Likes
1,104

Hi,

Selecting data into an internal table using an array fetch versus a SELECT-ENDELECT loop will give at least a 2x performance improvement. After the data has been put into the internal data, then row-level processing can be done.

Example:

select ... from table <...>

into <itab>

where ...

loop at <itab>

<do the row-level processing here>

endloop.

Best regards,

Prashant

Read only

Former Member
0 Likes
1,105

hi ofir kadosh,

Check these links...

1.

3.

5.

Hope this helps you.

Regards,

Maheswaran.B

Read only

Former Member
0 Likes
1,104

Hi Ofir

Select-Endselect provides a looping mechanism in which every time the database is accessed and the retrieved record is stored in the work area. Since number of data transfers and DB accesses are high, it causes low performance.

First to know about low performance of some ABAP statements, you should know the underlying system architecture and other performance factors. You can find it in the below url.

<a href="http://">http://help.sap.com/saphelp_nw04s/helpdata/en/fc/eb3b7e358411d1829f0000e829fbfe/frameset.htm</a>

Check this out. Dont forget to reward, if its worth :-).

Regards

Rakesh

Read only

Former Member
0 Likes
1,104

Hi Roy,

Here is what happens at the database level.

With a select/endselect statement the database opens a cursor and fills it with the solution set for the selection criteria with the first database access. However since the retrival structure (the work area that you select into) only holds one record, the data is retrived in a looping mechanism where the database hands you one record at a time. So, if your selection criteria yields 100 records, you have 100 network hits as you go back and forth to the database carrying back one record at a time.

With an array fetch (select into table) the entire contents of the database cursor are placed directly into your internal table in a single network hit. If you have 100 records, all 100 records are retrieved in one network hit.

The bottom line with ABAP is: Application server is fast, database server is slow - try to limit your contact with the database server.

Hope this helps.

Brent

Read only

Former Member
0 Likes
1,104

Hi,

In ABAP Editor goto

Environment->Examples->Performance Examples.

There U can see the performance of select statements.

Read only

Former Member
0 Likes
1,104

In addition to the explanation given by others, you can use PACKAGE SIZE n in select-endselect loop and decrease the database hits.

Read only

Former Member
0 Likes
1,104

One of the problems with select/endselect is the increased network traffic across the servers. You do a select on the DB server and return the results to the app server. Then you repeat the process. As I understand it, that's why you try to as much of the data in as few trips to the database as possible.

On the other hand, doing an array fetch on a non-index field will give more of a performance hit than select/endselect.

rob