Part Seq access Hashed vs sorted

来源:互联网 发布:淘宝如何提高销量 编辑:程序博客网 时间:2024/05/16 06:00

Partial sequential access on a sorted table

* Entries: 10000, Line width: 100
* key width: 60,  Subkey width: 20
* HTAB is a hashed table, 2000 entries are read
* Key fields: K, DATA

LOOP AT HTAB INTO WA WHERE K = SUBKEY.
  " ...
ENDLOOP.

 

 

Partial sequential access on a sorted table

* Entries: 10000, Line width: 100
* key width: 60,  Subkey width: 20
* STAB is a sorted table, 2000 entries are read
* Key fields: K, DATA

LOOP AT STAB INTO WA WHERE K = SUBKEY.
  " ...
ENDLOOP.

 

 

Documentation
Hashed tables are optimized for single entry access. The entries have
no specific order. Therefore, a partial sequential access cannot be
optimized. Every entry must be checked to match the condition
(full table scan).
Sorted tables are ordered ascendingly by their key components. If
a partial key of the form "k1 = v1 AND ... AND kn = vn" where k1 .. kn
matches a left part of the table key, the access is optimized by the
kernel. In that case, only the matching entries are visited.