In another question a user asks how to force row level locking. The answer that he receives tell them how to force row level locking by altering the table and the indexes. The user that answered the question does also mentions that there can be a side effect of preventing index reorganization.

What i want to know is if someone could explain this side effect further, because our worry is that a table the is inserted into and deleted from a lot, could become slow over time if the side effect of forcing row level locking does what we think it does.

Orginal post:

How to force the use of row locks?

Many thanks in advance


1 Answer 1


In the referenced link How to force the use of row locks? Paul White demonstrates that index reorganization cannot happen if that index has page locks disabled.

You can, of course, reset Page locking back on before doing a reorganization and then turn it off again afterward:

-- Allow page locks on Index
ALTER INDEX indexname ON tablename SET (ALLOW_PAGE_LOCKS = ON);

For what it is worth, in response to this question https://stackoverflow.com/questions/3114826/is-it-possible-to-force-row-level-locking-in-sql-server Remus Rusanu gives the statement on disabling page locking on an index. But he also comments: "I would never turn this OFF on my database. The solution is always to properly design the schema and the queries so that scans (which are the culprits for escalation) don't occur to start with."

This does not mean that it is wrong to disable page locking, but it points out that there are other ways to work through the problem.

You also might be interested in reading about Lock Escalation (SQL Server 2008 R2 is the most recent document I can find) at: http://technet.microsoft.com/en-us/library/ms184286(v=sql.105).aspx

  • What if you disable lock escalation on an index vs. disabling page locking. If you disable lock escalation and use rowlock hint, but leave page locks "enabled", wouldn't that achieve the same thing without interfering with index rebuilding?
    – Triynko
    Nov 4, 2019 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.