‎2008 Aug 27 1:13 PM
What is the advantage/disadvantage (over each other) of sorting using the 2 options below?
1. sorting a table through the select command (Ex. "into sorted table").
2. sorting a table using the sort keyword (Ex. "sort table itab by carrid").
thanks for the help.
‎2008 Aug 27 1:15 PM
sorting the table using select may take more time and where as the second one is consumes less time
‎2008 Aug 27 1:15 PM
sorting the table using select may take more time and where as the second one is consumes less time
‎2008 Aug 27 1:17 PM
Jabbar Junzo
by performance wise
sort table itab by carrid this one is better
because here we process in ABAP memory during runtime
but in first case ( it directly deal with records in Database it consume more time to fetch a record)
regards
deva
‎2008 Aug 27 1:17 PM
One you are sorting the data at the sametime while retriving it form database and the 2nd one you are sorting after getting the data in your internal table.
So if there is selection criteria its better to sort after retriving the data in your internal table, performance wise this is better
With luck,
Pritam.
‎2008 Aug 27 1:18 PM
Hi,
By performance wise 2 nd statement is fine bz SORT is a abap keyword.
So after getting data into int table u have to use sort int table. If in the select query u use sorting then the performance will be down bz for every select statement the data going to sort.
thanks,
Edited by: Baidyanath Subudhi on Aug 27, 2008 5:48 PM
‎2008 Aug 27 1:18 PM
Hi,
A Very good question.
Sorting with select query makes your internal table data as in the sorted by option.But it takes much time as the burdon on the database server is more.
Where as Sort itab makes more performance.
Regards,
Rama.
‎2008 Aug 27 1:18 PM
disadvantage at No. 1 is that you are using a sorted table.
means you gotta take care when working with it. E.G. Append will not work tho you gotta insert instead.
another disadvantage is that it uses more time than just doing an array fetch and the sorting the stuff.
‎2008 Aug 27 1:20 PM
Hi,
For first select ... into sorted table...
it has to select the data as well as sort at same time so lot of performance issue.
for second sort itab... its juz matter of sorting so not that much overhead..
thanx.
‎2008 Aug 27 1:21 PM