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.
Showing results for 
Search instead for 
Did you mean: 

Performance of collect statement

Former Member
0 Kudos

Hi Experts,

I have a doubt regarding the performance of collect statement. Is it faster using collect statement or is it faster using read statement and performing the calculations manually. Please advise me. thanks.



0 Kudos


The runtime of a COLLECT increases with the width of the table key and the number of numeric fields whose contents are summated.

It depends on how many records you are going to process.

Read with binary search will definately improve the performance.

Reward if helpful.



Former Member

If the Records are less, Read is not BAD. But if the records are more, >1000, Collect is the way to go!!!

READ BINARY runs in less time, and the internal table's index must be adjusted with each iteration.

COLLECT, however, uses a hash algorithm and is therefore independent of the number of entries and does not need to maintain a table index. If you need the final data sorted, sort it after all data has been collected.

If the amount of data is small, the READ approach isn't bad, but for larger amounts of data (>1000), COLLECT is much faster.


When you fill an internal table, do not use COLLECT in combination with any other table-filling statements (APPEND, INSERT, MODIFY, SELECT * INTO TABLE and/or SELECT * APPENDING TABLE).

If you mix COLLECT with the other statements, COLLECT cannot use its hash algorithm. In this case, COLLECT resorts to a normal linear search, which is dramatically slower:

Hope this helps.

Vinodh Balakrishnan

Former Member
0 Kudos


to performing the calculations like totals, subtotals choose the collect statement . it is faster than the read statement.

read statement check the record by record in the internal table.

wheras collect will do the calculations in the work area and pu t into the internal table level.

Former Member


Collect and Append act as same if u have distinct records based on primary key or non numeric field.

For eg. if i wanted to append emp id 101 to an internal table having 100 employees starting from emp id 001 to 100 then i can do it using both collect and append.

Now Collect is differnt if an internal table is having numeric and non numeric values

For eg. If i have internal table having Emp id and Reimbursements and i wanted to add more reimburesemnt for same emp id say 100 then Append will add one more record to same internal table while collect will add the reimbursements and will show only one record for each emp id say 100.

If Internal table is sorted then the performance improves .

PS: Reward points if Helpfull


Naveen Gupta