On 2010-10-15 20:15, Steve wrote:
> We use the WITH ROWLOCK hint when we are updating a single row in a
> table. We use this for both tables and views when a single row is
> being updated. We are running into issues where the WITH ROWLOCK on a
> VIEW is escalating to a page lock, which is the exact behavior that
> WITH ROWLOCK is supposed to prevent.
>
SQL Server does not escalate to page locks. If it escalates, it always
escalates to table locks. See
http://www.sqlskills.com/BLOGS/PAUL/post/A-SQL-Server-DBA-myth-a-day-%...330%29-
and for more detail
http://blogs.msdn.com/b/sqlserverstorageengine/archive/2006/05/17/lock...calatio
ROWLOCK only prevents SQL Server from taking page or table locks initially
(if it decides it's more worthwhile than locking rows individually). If
escalation needs to happen, it will still happen. However, as Erland has
pointed out, a single row update should normally take row locks already, so
if escalation is still happening you are facing lock memory problems.
I have no direct experience in confirming this, so if you have a profiler
trace that says lock escalation is happening differently, that would be
interesting.
--
J.
>> Stay informed about: WITH ROWLOCK Hint and VIEWS