13.01.2013 Views

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Block cursors on versus off<br />

Cursors<br />

Block cursors are the default over lookahead cursors when PRGRS_BLOCK_CURS is enabled and a<br />

server-side cursor is needed. The switch -Dsrv PRGRS_BLOCK_CURS,0 will turn off block cursors<br />

in MS <strong>SQL</strong> <strong>Server</strong> if you want to turn off the feature <strong>for</strong> this connection. You can always disable<br />

block cursors <strong>for</strong> a specific query by disabling lookahead with a query tuning option:<br />

QUERY-TUNING(NO-LOOKAHEAD). Block cursors is not a one size fits all feature. There are<br />

application environments where the default values <strong>for</strong> block allocation sizes can result in either<br />

under-utilization or over-utilization of memory. See the “Using the block cursor switches”<br />

section on page 8–11 <strong>for</strong> in<strong>for</strong>mation on tuning the amount of memory that block cursors<br />

utilizes.<br />

For any given query, the use of a block cursor or a lookahead cursor is mutually exclusive. In<br />

certain circumstances, block cursors will downgrade to lookahead. These are the criteria:<br />

• When -Dsrv BINDING,0 is set. When binding is off, block cursors are disabled.<br />

• Predictable single record result sets—FOR FIRST/FOR LAST or dynamic find operations.<br />

• The PRGRS_TABLE_BLOCKSIZE has been exceeded and all existing block table space is<br />

in-use by open cursors.<br />

• The accumulation of memory allocated to all block cursors has reached<br />

PRGRS_MAX_BLOCKSIZE.<br />

• The QT_CACHE_SIZE query-tuning (CACHE-SIZE) value is not larger than 2 times the<br />

maximum row size. At least 2 rows need to fit in the result block to use a block cursor.<br />

Note: The macro BLOCKBUF_AVAILABLE can be used to determine if the current query is or is<br />

not using a block cursor.<br />

Block versus lookahead cursors<br />

Block cursors and lookahead cursors are both associated with NO-LOCK queries. These are<br />

queries where the lock status has been explicitly set to NO-LOCK or where the lock status has been<br />

explicitly set to SHARE-LOCK and the transaction isolation level is set to read-uncommitted.<br />

Block cursors and lookahead cursors are mutually exclusive.<br />

Block cursors are more efficient than lookahead cursors <strong>for</strong> the following reasons:<br />

• The results of a query are bound directly to the area from which they are copied into the<br />

record buffer on the client. Lookahead cursors copy out of a common bind area into the<br />

lookahead cache and then are copied into client record buffer resulting in multiple copies<br />

of the data.<br />

• The fetch process used by block cursors fetches multiple rows at a time, reducing the<br />

number of driver calls and potentially reducing the total number of network round trips to<br />

the server.<br />

• Block cursor memory is preallocated prior to fetching a result set, whereas lookahead<br />

cursors post allocate memory as records are fetched from the result set.<br />

• Block cursors are directly linked to the result set binding feature whereas lookahead<br />

cursors have no particular dependency on whether binding or late-binding is active.<br />

2–51

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!