Jump to content

Implicit Locking?


davej
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...