This post takes the DB transaction discussion to one step further. Two ways the application developers handle DB concurrency are optimistic locking and pessimistic locking. While transaction isolation levels are used to implement pessimistic locking, optimistic level is implemented using versioning and timestamp columns. More details on these concurrency measures are provided below. Optimistic Locking : As the name suggests, it takes an optimistic approach. It allows the concurrency issues to happen and then takes actions to handle that. Hence, there is no preventive measure. It is suitable for a database having relatively large number of records and less users making concurrency possibility low. It doesn't lock the rows, but used version or timestamp columns to check for updates. It's pretty easy to implement. Pessimistic Locking : This is in total opposite to the optimistic locking, here it prevents the concurrency issues beforehand by locking the DB rows so that these...
In this blog, I often try to post the facts(read my experience) and their effects in my life which caricature myself as the 'Jack of all trades, master of none'!