<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Optimistic Locking &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/optimistic-locking/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Tue, 14 Nov 2017 07:21:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>Database Theory: What is Optimistic Locking and Pessimistic Locking?</title>
		<link>https://www.dbrnd.com/2016/04/database-theory-what-is-optimistic-locking-and-pessimistic-locking/</link>
					<comments>https://www.dbrnd.com/2016/04/database-theory-what-is-optimistic-locking-and-pessimistic-locking/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 07 Apr 2016 05:04:31 +0000</pubDate>
				<category><![CDATA[Database Theory]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database concept]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database standards]]></category>
		<category><![CDATA[database topic]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Optimistic Locking]]></category>
		<category><![CDATA[Pessimistic Locking]]></category>
		<category><![CDATA[RDBMS]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2368</guid>

					<description><![CDATA[Pessimistic Locking: This is a standard locking like an Exclusive lock or Shared lock. The reader is blocked by writer and writer is blocked by the reader. SQL Server Isolation levels like Read Committed, Repeatable Read, Serializable are mostly doing Pessimistic Locking. It locks the transaction whenever something is going wrong and it puts the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fdatabase-theory-what-is-optimistic-locking-and-pessimistic-locking%2F&amp;linkname=Database%20Theory%3A%20What%20is%20Optimistic%20Locking%20and%20Pessimistic%20Locking%3F" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fdatabase-theory-what-is-optimistic-locking-and-pessimistic-locking%2F&amp;linkname=Database%20Theory%3A%20What%20is%20Optimistic%20Locking%20and%20Pessimistic%20Locking%3F" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fdatabase-theory-what-is-optimistic-locking-and-pessimistic-locking%2F&amp;linkname=Database%20Theory%3A%20What%20is%20Optimistic%20Locking%20and%20Pessimistic%20Locking%3F" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fdatabase-theory-what-is-optimistic-locking-and-pessimistic-locking%2F&amp;linkname=Database%20Theory%3A%20What%20is%20Optimistic%20Locking%20and%20Pessimistic%20Locking%3F" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fdatabase-theory-what-is-optimistic-locking-and-pessimistic-locking%2F&amp;linkname=Database%20Theory%3A%20What%20is%20Optimistic%20Locking%20and%20Pessimistic%20Locking%3F" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fdatabase-theory-what-is-optimistic-locking-and-pessimistic-locking%2F&amp;linkname=Database%20Theory%3A%20What%20is%20Optimistic%20Locking%20and%20Pessimistic%20Locking%3F" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fdatabase-theory-what-is-optimistic-locking-and-pessimistic-locking%2F&#038;title=Database%20Theory%3A%20What%20is%20Optimistic%20Locking%20and%20Pessimistic%20Locking%3F" data-a2a-url="https://www.dbrnd.com/2016/04/database-theory-what-is-optimistic-locking-and-pessimistic-locking/" data-a2a-title="Database Theory: What is Optimistic Locking and Pessimistic Locking?"></a></p><p><strong>Pessimistic Locking:</strong></p>
<blockquote><p>This is a standard locking like an Exclusive lock or Shared lock. The reader is blocked by writer and writer is blocked by the reader. </p></blockquote>
<blockquote><p>
SQL Server Isolation levels like <a href="https://www.dbrnd.com/2016/04/sql-server-read-committed-isolation-level-with-the-read_committed_snapshot-option/" target="_blank"><strong>Read Committed</strong></a>, <a href="https://www.dbrnd.com/2016/04/sql-server-what-is-repeatable-read-isolation-level/" target="_blank"><strong>Repeatable Read</strong></a>,<a href="https://www.dbrnd.com/2016/04/sql-sever-what-is-serializable-isolation-level/" target="_blank"><strong> Serializable</strong></a> are mostly doing Pessimistic Locking. </p></blockquote>
<blockquote><p>It locks the transaction whenever something is going wrong and it puts the transaction into the <a href="https://www.dbrnd.com/2016/04/database-theory-what-is-timeout-lock-block-and-deadlock-in-a-database-system/" target="_blank"><strong>blocking queue. </strong></a><br />
Pessimistic locking allows you to access live and committed data, there are no chances for accessing dirty data. </p></blockquote>
<blockquote><p>The big OLTP system like banking system or finance system are always preferred to use Pessimistic Locking because data accuracy is required for both reader and writer.</p>
<p>Yes, locking is an extra overhead in a big system, but a few types of the application required for accuracy. </p></blockquote>
<p><strong>Optimistic Locking: </strong></p>
<blockquote><p>It is also called as row versioning, and it never blocks any transaction. </p></blockquote>
<blockquote><p>The <a href="https://www.dbrnd.com/2015/05/what-is-mvcc-multi-version-concurrency-control/" target="_blank"><strong>MVCC architecture</strong></a> is most popular now a day and it depends on Optimistic Locking concept.<br />
The RDBMS like PostgreSQL and MySQL InnoDB is fully based on MVCC.<br />
Microsoft SQL Server has also <a href="https://www.dbrnd.com/2016/04/sql-server-what-is-snapshot-isolation-level/" target="_blank"><strong>Snapshot Isolation</strong></a> which is one type of Optimistic Locking. </p></blockquote>
<blockquote><p>The Reader never blocks the writers and writers never blocks the readers.</p></blockquote>
<blockquote><p>Internally, it is managing different row versions, so if the reader is reading one version of data and at the same time writer can also update the same data by creating a new version of that data, Next time readers can read new version of data and old version of data is marked as dead tuple. </p></blockquote>
<blockquote><p>There are 70% chance to get last committed version of data while accessing data using Optimistic locking, but it gives fast access because it never creates a dependency between transactions. </p></blockquote>
<blockquote><p>Generally, most of the web and mobile applications are fine with the last committed version of data. </p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/04/database-theory-what-is-optimistic-locking-and-pessimistic-locking/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
