Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Difference in Performance for 3 Table Types in Specific Circumstances

$
0
0

Dear gurus,

 

Can anyone tell me which way is better to access data within a range in an internal table which holds thousands to tens of thousands entries? Thank you!


1.  Standard table.

Sort table.

Read table with key1 = value1.

Loop at table from sy-index

                    where key2 > value2 and key3 < value3.

      Get the data. Exit.

End Loop.


2. Sorted table.

Loop at table where key1 = value1

                    and key2 > value2 and key3 < value3.

(Some document says it will use binary search automatically when looping. Hope it is true.)

      Get the data. Exit.

Endloop.


3. Hashed table with unique key.

Loop at table where key1 = value1

                    and key2 > value2 and key3 < value3.

(No doubt that some hash algorithm will be used here. Can anyone kindly tell me what is the exact hash algorithm adopted by SAP ABAP?)

      Get the data. Exit.

Endloop.


And what if the internal table to search through has a lot of keys (far more than 3 keys), say 20 keys to compare? I have found a post, Runtimes of Reads and Loops on Internal Tables (http://scn.sap.com/community/abap/testing-and-troubleshooting/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables). But I still have doubts after reading it.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>