The buffer scan operation is used when a query is processed using DB2® UDB Symmetric Multiprocessing, yet a portion of the query is not enabled to be processed under parallelism. The buffer scan acts as a gateway to control access to rows between the parallel enabled portions of the query and the non-parallel portions.
Multiple threads can be used to fetch the selected rows from the buffer, allowing the query to perform any remaining processing in parallel. However, the buffer will be populated in a non-parallel manner.
A buffer scan operation is identical to the list scan operation that is performed upon the temporary list object. The main difference is that a buffer does not need to be fully populated before the start of the scan operation. A temporary list requires that the list is fully populated before fetching any rows.
Data access method | Buffer scan |
---|---|
Description | Sequentially scan and process all of the rows in the temporary buffer. Enables SMP parallelism to be performed over a non-parallel portion of the query. |
Advantages |
|
Considerations | Generally used to prevent portions of the query from being processed multiple times when no key columns are required to satisfy the request. |
Likely to be used |
|
Example SQL statement | CHGQRYA DEGREE(*OPTIMIZE) CREATE INDEX X1 ON Employee (LastName, WorkDept) SELECT * FROM Employee WHERE WorkDept BETWEEN 'A01' AND 'E01' AND LastName IN ('Smith', 'Jones', 'Peterson') OPTIMIZE FOR ALL ROWS |
Messages indicating use |
|
SMP parallel enabled | Yes |
Also referred to as | Not applicable |
Visual Explain icon |
Using the example above, the optimizer chose to use the existing index X1 to perform an index probe operation against the table. In order to speed up the remaining processing for this query (for example, the Table Probe operation), DB2 Symmetric Multiprocessing will be used to perform the random probe into the table. Since the index probe operation is not SMP parallel enabled for the SQL Query Engine, that portion of the query is placed within a temporary buffer to control access to the selected index entries.