ARTIClE
Internal Tables, Key Accesses
This example measures the runtime of the statement READ TABLE
with various table keys.
ABAP_SOURCE_CODE
ABAP_EXEC
ABAP_DESCRIPTION
The table itab is a standard table with a non-unique primary key,
a unique secondary sorted key, and a unique secondary hashed key. For
demonstration purposes, this program hides the syntax warning about
different table keys in an internal table having the same components, by
using the pragma ##TABKEY .
The program measures the average access time of the statement
READ
TABLE to individual table rows, dependent on the number of rows in
the table. The rows are accessed using the various keys. The keys are
specified statically in the method measure_static and dynamically
in the method measure_dynamic .
The result demonstrates that the response times for static access are as
expected from around 50 to 100 table rows:
When a standard table is accessed using the primary key, the average
access time rises in a linear fashion with the number of table rows.
When a standard table is accessed using a secondary sorted key, the
average access time rises in a logarithmic fashion with the number of
table rows.
When a standard table is accessed using a secondary hash key, the access
time is constant.
In dynamic accesses, each access incurs the additional time required to
analyze the dynamically specified key.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved