Jump to content

Implicit Locking?


davej

Recommended Posts

I was just thinking about the situation where you use;

UPDATE TABLE1SET NumberAvail = NumberAvail + 1WHERE PartNumber = @PN

Now certainly that would be accomplished as a RMW cycle, wouldn't it? Can it be absolutely trusted or not?

Link to comment
Share on other sites

I guess it can be "absolutely trusted" if the database management system supports isolated transactions. If you're talking about guaranteeing that all rows in the table get updated before anything else happens, that would depend if the database system or storage engine is using table locking or row locking. With MySQL, for example, the MyISAM engine uses table locking, where it locks an entire table while a query is working on that table. The InnoDB engine uses row locking, so it only locks each row it is working with instead of the entire table. You probably want to research ACID transactional properties for databases and see if they apply to your situation.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...