SAP内表选择及性能优劣

标准表:关键字为STANDARD TABLE, 系统为该表的每一行数据生成一个逻辑索引。 填充标准表时,可以将数据附加在现有行之后,也可以插入到指定的位置,程序对内表行的寻址操作可通过关键字或索引进行。在对表进行插入、删除等操作时,各数据行在内存中的位置不变,系统仅重新排列各数据行的索引值。

排序表:关键字为 SORTED TABLE, 也具有一个逻辑索引,不同之处是排序表总是按其关键字升序排序后再进行存储,其访问方式与标准表相同。

哈希表:关键字为 HASHED TABLE, 没有索引,只能通过关键字来访问。系统用哈希算法管理表中的数据,因而其寻址一个数据行的时间和表的行数无关。

 

Table选择,以及性能优劣:

Slowest table accesses are sequential and grow linearly with n.

¨  READ standard table WITH (TABLE) KEY (no BINARY SEARCH)

¨  LOOP at standard/hashed table.

¨  READ sorted/hashed table WITH KEY (not TABLE KEY).

Faster accesses use a sorted index and have a weak dependence on n.

¨  READ standard table WITH (TABLE) KEY using BINARY SEARCH)

¨  READ sorted table WITH TABLE KEY.

¨  LOOP at sorted table.

Fastest access independent of n.

¨  READ hashed table WITH TABLE KEY.

¨  READ standard table WITH INDEX

¨  READ sorted table WITH INDEX.

Note: n = number of lines in the internal table

posted @ 2017-07-20 10:24  我得意的笑了笑的  阅读(529)  评论(0编辑  收藏  举报