I have an application using a fast_forward cursor to loop through data in a table and perform other tasks in each cursor iteration.
The cursor is defined as follows:
DECLARE invoice_cursor CURSOR FAST_FORWARD FOR
That statement is blocking inserts into the invoice table.
Would the blocking be alleviated if I placed a NOLOCK hint in the SELECT statement above?
Or would it be better if I used a STATIC cursor instead to alleviate the blocking?
And one last question: are shared locks acquired on the underlying tables when a fast_forward cursor is first opened?
I would think yes, but I would like to confirm (for my sanity's sake 🙂 ).
(I already know that shared locks are obtained on each row as it is fetched).
And, yes, I agree that cursors are "bad" and all that, but this is not my application. 🙂
I'm just trying to manage the blocking without major code rewrites.
SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
Persisting SQL Server Index-Usage Statistics with MERGE[/url]
Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]