‎2008 Feb 07 1:15 PM
Hi All,
I am new to ABAP. I want to know wherether it is better to fire a READ TABLE based on key or index.
Which one would be faster ?
thanks in advance,
Ashish
‎2008 Feb 07 1:27 PM
Index will be faster to start with,
but if you use BINARY SEARCH addition when you use KEY, then the serach speed will increase considerably.
to use BINARY SEARCH addition in READ statement, the internal table must be sort by the key you are using to search.
Regards,
Ravi Kanth Talagana
‎2008 Feb 07 1:27 PM
Index will be faster to start with,
but if you use BINARY SEARCH addition when you use KEY, then the serach speed will increase considerably.
to use BINARY SEARCH addition in READ statement, the internal table must be sort by the key you are using to search.
Regards,
Ravi Kanth Talagana
‎2008 Feb 08 4:57 AM
Hi All,
Thanks for your suggestions !!!
Best Regards,
Ashish
‎2008 Feb 07 3:57 PM
An INDEXed READ will be faster than a BINARY SEARCH.
Rob
‎2008 Feb 07 9:19 PM
Your question does not really make sense, reading with key or index are not equal
options. Usually you will know the key, but rarely the index! The index is only know, if you work inside a loop on the same table.
Use search blog and my last name 'boes' there is a blog with extensive runtime measurements!
Binary search splits to table into halves and reduces this until the correct line is found,
so the runtime grows logarithmically with the size of the table ( N = number of lines).
Standard tables allow binary search, sorted tables have automatically a binary search.
Index search jump directly to the wanted line, i.e independent of the table size. Also hashed
reads work like that.
Siegfried