ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Access → ABAP SQL → ABAP SQL - Overview
ABAP SQL - Table Buffering
Table buffering buffers data from database tables or database views defined in ABAP Dictionary in a table buffer in the shared memory of the current AS Instance. The definition determines whether and how a database table or database view is buffered. Using buffering generally produces much improved performance (by factors of between 50 and 500), since the data does not need to be transported between the AS ABAP and the database server each time and because processes do not need to be switched.
- When a database table or a database view is accessed using ABAP SQL, table buffering is active by default if it is defined in ABAP Dictionary for the database table or view.
- Table buffering can also be switched on for a CDS view and is applied to the associated CDS database view.
Table buffering is applied by the database interface when buffered tables or views are accessed using ABAP SQL statements. If a program uses ABAP SQL to read data in a buffered table or view, the table or view is accessed using the table buffer (with some exceptions). To do this, the database interface determines whether this data is in the table buffer of the current AS Instance. If this is the case, the data is read directly from the buffer. If the data is not in the buffer of the AS Instance, the data is read from the database and loaded into the buffer. This means the data can accessed from the buffer next time. Writes cause the buffer to be synchronized asynchronously.
The buffering type defines which records are loaded to the buffer when accessed. There are also, however, variants of ABAP SQL statements that cannot be executed using the table buffer and which therefore bypass table buffering. Native SQL access or AMDP methods are applied to the database directly and therefore always bypass table buffering.
Other versions: 7.31 | 7.40 | 7.54
Notes
- Typical candidates for buffering are customizing tables and system tables. In certain cases, customizing-like
tables with master data can also be buffered. If it is vital that current data is accessed from a buffered
table, the addition
BYPASSING BUFFER
of the statementSELECT
can be used. If this addition is used a lot, the table should be checked for its suitability for buffering or whether the current data is really always required.
- Buffering is not recommended for tables in the following cases:
- The application must always have access to the current data and the delay caused by asynchronous synchronization is not acceptable.
- Many writes are performed on the tables. If more than one percent of the accesses are writes, buffering should be avoided. If not, the extra work caused by synchronization could outweigh the benefits of buffering.
- Null values are handled as null values in the table buffer. They are not transformed to type-dependent initial values.
- Tables or views that can also be accessed using
Native SQL or AMDP should not be buffered. If Native SQL statements or AMDP methods modify data in buffered tables or views, this is ignored by the database interface and the buffers are not synchronized accordingly. This can cause inconsistencies between the data in the buffers and on the database.
- A self-defined buffering of formatted data in the shared memory can be produced using shared objects.
- Except in the case of ABAP SQL database access, table buffering also applies in database access from classic dynpros.
Continue
Table Buffering - Buffering Types
Table Buffering - Buffer Synchronization
Table Buffering - Buffer Management