Cursor Stability; Virtual Sequential Block Buffering (Vsbb) - HP NonStop SQL/MP Programming Manual

For c
Table of Contents

Advertisement

Data Retrieval and Modification

Cursor Stability

Cursor stability guarantees that a row at the current cursor position cannot be modified
by another program. For NonStop SQL/MP to guarantee cursor stability, you must
declare the cursor with the FOR UPDATE clause or specify the STABLE ACCESS
option.
In some cases, a program might be accessing a copy of a row instead of the actual
row. For example, a program might be accessing a copy of the row if the associated
SELECT statement defining the cursor requires that the system perform any of these
operations:
Ordering the rows by a column
Removing duplicate rows
Performing other operations that require the selected table to be copied into a
result table before it is used by a program
If your program is accessing a copy of a row instead of the actual row, the cursor
points to a copy of the data, and the data is concurrently available to other programs.
Accessing a copy of the data, however, never occurs if the cursor is declared with the
FOR UPDATE clause. In this case, your cursor points to the actual data and has cursor
stability.

Virtual Sequential Block Buffering (VSBB)

The SQL/MP optimizer often uses Virtual Sequential Block Buffering (VSBB) as an
access path strategy. Conflicting UPDATE, DELETE, or INSERT statements can
invalidate a cursor's buffering for a table. Each invalidation forces the next FETCH
statement to send a message to the disk process to retrieve a new buffer, which can
substantially degrade a program's performance. These statements invalidate the buffer
for cursor operations:
An INSERT statement on the same table by the current process
A stand-alone UPDATE or DELETE statement on the same table (directly or
through a view) by the same process
An UPDATE...WHERE CURRENT or DELETE...WHERE CURRENT statement
using a different cursor to access the same table (directly or through a view) by the
same process
For example, a loop containing both a FETCH statement and a stand-alone UPDATE
or DELETE statement on the same table invalidates the cursor's buffer on every loop
iteration. You can minimize or eliminate this problem by following these guidelines:
Do not use INSERT statements within a cursor operation.
Use the UPDATE...WHERE CURRENT or DELETE...WHERE CURRENT
statement for a cursor rather than a stand-alone UPDATE or DELETE statement.
HP NonStop SQL/MP Programming Manual for C—429847-008
4-17
Cursor Stability

Advertisement

Table of Contents
loading

Table of Contents