‎2007 Sep 22 5:48 AM
Hi Experts,
What is the Diffrence btwn
Read Table with Binary Search And
Read Table with index.
thanks.
Khan.
‎2007 Sep 22 5:58 AM
Khan,
Read table with binary search is the best way to read an table because it enhances performance provided we had sorted the table beforehand.
Suppose an internal table is having the following data
1 2 3 4 5 6 7 8 and we are reading the table where a field is equal to 4 then binayr search will split the search into two parts say
first it will search for 4 among 1 2 3 4.
as it was able to find 4 in this part it will come out and go ahead with the next process.Suppose if it didn't find 4 in the first part then and then only it will go for next part of the search.This way it enhances the performance.But it is mandatory to sort the internal table before reading the table using binary search.
K.Kiran.
Message was edited by:
Kiran K
‎2007 Sep 22 5:56 AM
hi,
read table with index will locate correctly the record at the particular index,
with binary search will be useful if ur internal table is having larger number of records, ur perfomance ll be fast
regards
karthik
‎2007 Sep 22 5:58 AM
Khan,
Read table with binary search is the best way to read an table because it enhances performance provided we had sorted the table beforehand.
Suppose an internal table is having the following data
1 2 3 4 5 6 7 8 and we are reading the table where a field is equal to 4 then binayr search will split the search into two parts say
first it will search for 4 among 1 2 3 4.
as it was able to find 4 in this part it will come out and go ahead with the next process.Suppose if it didn't find 4 in the first part then and then only it will go for next part of the search.This way it enhances the performance.But it is mandatory to sort the internal table before reading the table using binary search.
K.Kiran.
Message was edited by:
Kiran K
‎2007 Sep 23 4:10 AM
If you check the documentation for the READ statement, I think you'll see that using the index is faster than a binary search.
Rob