Forgot to say...
HOLDLOCK, UPDLOCK will increase deadlock probability; ROWLOCK will improve concurrency for the obvious reasons.
Also, HOLDLOCK is the same as the SERIALIZABLE and it's unclear why you need UPDLOCK in addiditon to HOLDLOCK as they behave in the same way but UPDLOCK is stronger than HOLDLOCK. You may want to use UPDLOCK if you want to reserve the row for a subsequent update and get rid of HOLDLOCK.
ROWLOCK is the only 'tool' to improve concurrency but before doing this you need to analyze and clearly understand your locking scenarios.
VC
Main Topics
Browse All Topics





by: vc01778Posted on 2004-06-03 at 08:39:48ID: 11223825
1. "select blah from blah WITH(HOLDLOCK)"
The holdlock hint leaves shared locks behind until the transaction is finished. Normally, the lock is removed as soon as the row/page was processed.
The updlock hint will block another select with the same hint because it puts an update lock instead of a shared lock so the concurrecy and pottential for dead-locking with this hint will be higher. It won't block a statement with the holdlock+rowlock hints and vice versa.
2. "select blah from blah WITH(UPDLOCK, HOLDLOCK, ROWLOCK)"
The rowlock hint will prevent (when possible) the lock escalation to the page/table level from happenning. The concurrency will improve at the expense of memory consumed by the lock manager to maintain the row level locks.
VC