HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Why SQL server does not have column-level locking?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
whycolumnsqllevellockingdoesservernothave

Problem

As far as i know, the lowest level locking is row-level

However i don't see the reason why it can not have column level locking

Assume that 2 queries simultaneously updates 2 different columns.

So why it can not happen? Why each update has to lock at least row level?

This behavior tells me that i should split table into smaller tables so less row level locking would happen

Am i incorrect?

Solution

This feature could exist. It would consume resources and complicate the architecture. So it's a trade-off that had to be made.

For the same reason some databases go in the opposite direction: They lock on the page or table level. MongoDB even has a global write lock for the entire database! This surely makes some physical implementation concerns much easier.

SQL Server's locking model already is quite sophisticated and, in my experience, addresses practical scenarios very well. I'm not sure column level locking would make it a better product (even if the developer time were free for Microsoft).

Context

StackExchange Database Administrators Q#147179, answer score: 3

Revisions (0)

No revisions yet.