Show TOC

Background documentationStatements Bypassing the Buffer Locate this document in the navigation structure

 

More complex queries are passed onto the database server instead of using the table buffer. Such queries are the following:

Additionally, the following statement that locks the selected rows is executed by the database:

The table buffer is also bypassed when the isolation level is other than READ_UNCOMMITTED. The READ_UNCOMMITTED level implies that other transactions can view uncommitted changes in the table buffer. For other isolation levels the data must be committed, and it is read directly from the database because the table buffer operates in “dirty read” mode.

Finally, sometimes it could be necessary to read from the database to avoid any uncertainty of out-dated data (what is discussed in the next section). Therefore it is possible to add “BYPASSING BUFFER” as a comment within a SELECT statement to assure that the request is not handled by the buffer but by the database.

Example

As an example we consider a table MYTAB with the key fields KEY1, KEY2, and KEY3 and the data field DATA. Let us assume the granularity of the buffer key range to be KEY1, KEY2.

Syntax Syntax

Queries Bypassing the Buffer
  1. SELECT /*@ SAP BYPASSING BUFFER */ * FROM MYTAB 
        WHERE KEY1 = ? AND KEY2 = ?
    
    SELECT * FROM MYTAB WHERE KEY1 = ?
    
    SELECT * FROM MYTAB 
        WHERE KEY1 = ? AND KEY2 = ? OR KEY1 = ?
    
    SELECT MAX(DATA) FROM MYTAB WHERE KEY1 = ? KEY2 = ?
    
    SELECT * FROM MYTAB 
        WHERE KEY1 = ? AND KEY2 = ? AND DATA = 
       (SELECT DATA FROM MYTAB WHERE KEY1 = ? AND KEY2 = ?)
    
End of the code.