Buffering modes
The smart-large-object open mode includes a buffering mode, which determines how read and write operations on the open smart large object are buffered.
Buffering mode | Purpose |
---|---|
Buffered access | Indicates that I/O of the smart-large-object data
goes through the buffer pool of the database server This method of access is called buffered I/O. Buffered I/O tells the optimizer that someone might be planning to reread the same LO page. |
Unbuffered access | Indicates that I/O of the smart-large-object data
does not use the buffer pool This method of access is called lightweight I/O. Lightweight I/O tells the smart-large-object optimizer to use private buffers instead of the buffer pool for these I/O operations. These private buffers are allocated out of the session pool of the database server. With lightweight I/O, you bypass the overhead of the buffer pool management when the database server performs a sequential scan. |
- Be sure that you close smart large objects that use lightweight
I/O.
Otherwise, the memory that has been allocated to the private buffers remains allocated. This private-buffer memory is only deallocated when you close the smart large object.
- Be careful about using lightweight I/O when you open the same
smart large object many times and concurrently access this object
in the same transaction.
All opens of the same smart large object share the same lightweight I/O buffers. Potentially, an operation can cause the pages in the buffer to be flushed while other operations might still expect these pages to exist.
- You can alter the buffering mode of a smart large object that
was created with lightweight I/O to buffered I/O as long as no open
instances exist for that smart large object.
However, you cannot alter the buffering mode from buffered I/O to one with lightweight I/O.
- You must specify lightweight I/O when you open a smart large object
that was created with lightweight I/O.
If an open smart large object specifies buffered I/O, the smart-large-object optimizer ignores any attempt to open it with lightweight I/O. However, if you first change the buffering mode from lightweight I/O to buffered I/O, you can then specify buffered I/O when you open the smart large object.
- You can specify lightweight I/O when you open a smart large object
that was created with buffered I/O only if you open the smart large
object in read-only mode.
In this case, the smart-large-object optimizer does not allow write operations on the smart large object. Attempts to do so generate an error. To write to the smart large object, you must close it then reopen it with buffered I/O and an access mode that enables write operations.
These limitations ensure consistency of the smart-large-object buffers without imposing processing overhead for I/O operations.
If you do not specify a buffering mode, the default is buffered I/O. The smart-large-object optimizer determines the default buffering mode for a smart large object.