The video outlines the difference between reading an internal table with without its key.
To speed up the access to the internal table using fields that are not part of the primary key, you can add one or more secondary keys to the definition of your internal table.
As shown in the figure, a secondary key of an internal table can be either sorted or hashed. As with the primary key of internal tables, a sorted key may be either unique or non-unique, while a hashed key must always be unique.
Watch this video to know how you can use a secondary key to improve internal table performance with secondary keys.
If an internal table has a non-unique secondary key, the system does not create the key until the program addresses the table using the key. Creating the key for the first time costs extra runtime, and consequently the first read access is generally more expensive than it would have if you had not used the key. However, once the key exists, subsequent read accesses are very fast (and considerably faster than reading the table without the secondary key).
If you change the table contents, the system does not automatically update the index, but waits to see if there are any more read accesses that use the secondary key. At the first subsequent read access, the system updates the secondary key. This is not as expensive as creating the key, but there are moderate update costs.
A unique secondary key has two purposes – firstly to speed up access to the table, and secondly to ensure that the key combination of all of the rows in the table is unique. Consequently, the system must always keep the key up to date and uses a different update strategy to secondary keys that are non-unique.
Any operation that changes the contents of the internal table (filling or changing its contents) leads to the index either being created (first access) or updated (subsequent accesses). Read accesses are always fast because the secondary index is always already up to date.