<?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>Dirty read &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/dirty-read/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>Thu, 09 Nov 2017 12:37: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>SQL Server: Database Lock, Deadlock, Block and Isolation Interview Questions and   Answers (Day-1)</title>
		<link>https://www.dbrnd.com/2016/06/sql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1/</link>
					<comments>https://www.dbrnd.com/2016/06/sql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 04 Jun 2016 17:52:40 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[acid]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[Check Constraint]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[DeadLock]]></category>
		<category><![CDATA[default trace]]></category>
		<category><![CDATA[Dirty read]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[locking]]></category>
		<category><![CDATA[phantom read]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2916</guid>

					<description><![CDATA[What is the ACID Properties in the Database System? ACID Properties in Database System (Atomicity, Consistency, Isolation, Durability) What is a Phantom read? A phantom read occurs when, in the course of a transaction, two identical queries are executed, and the collection of rows returned by the second query is different from the first. This [&#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%2F06%2Fsql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Lock%2C%20Deadlock%2C%20Block%20and%20Isolation%20Interview%20Questions%20and%20%20%20Answers%20%28Day-1%29" 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%2F06%2Fsql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Lock%2C%20Deadlock%2C%20Block%20and%20Isolation%20Interview%20Questions%20and%20%20%20Answers%20%28Day-1%29" 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%2F06%2Fsql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Lock%2C%20Deadlock%2C%20Block%20and%20Isolation%20Interview%20Questions%20and%20%20%20Answers%20%28Day-1%29" 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%2F06%2Fsql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Lock%2C%20Deadlock%2C%20Block%20and%20Isolation%20Interview%20Questions%20and%20%20%20Answers%20%28Day-1%29" 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%2F06%2Fsql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Lock%2C%20Deadlock%2C%20Block%20and%20Isolation%20Interview%20Questions%20and%20%20%20Answers%20%28Day-1%29" 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%2F06%2Fsql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1%2F&amp;linkname=SQL%20Server%3A%20Database%20Lock%2C%20Deadlock%2C%20Block%20and%20Isolation%20Interview%20Questions%20and%20%20%20Answers%20%28Day-1%29" 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%2F06%2Fsql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1%2F&#038;title=SQL%20Server%3A%20Database%20Lock%2C%20Deadlock%2C%20Block%20and%20Isolation%20Interview%20Questions%20and%20%20%20Answers%20%28Day-1%29" data-a2a-url="https://www.dbrnd.com/2016/06/sql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1/" data-a2a-title="SQL Server: Database Lock, Deadlock, Block and Isolation Interview Questions and   Answers (Day-1)"></a></p><p><strong>What is the ACID Properties in the Database System?</strong></p>
<blockquote data-secret="GZz3hgbH8E" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2015/05/acid-properties-in-database-system/">ACID Properties in Database System (Atomicity, Consistency, Isolation, Durability)</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/05/acid-properties-in-database-system/embed/#?secret=GZz3hgbH8E" data-secret="GZz3hgbH8E" width="600" height="338" title="&#8220;ACID Properties in Database System (Atomicity, Consistency, Isolation, Durability)&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What is a Phantom read?</strong></p>
<blockquote><p>A phantom read occurs when, in the course of a transaction, two identical queries are executed, and the collection of rows returned by the second query is different from the first.</p>
<p>This can occur when range locks are not acquired on performing a SELECT &#8230; WHERE operation.</p></blockquote>
<p><strong>What is a Dirty read?</strong></p>
<blockquote><p>Dirty read—Dirty reads occur when one transaction reads data that has been written but not yet committed by another transaction. If the changes are later rolled back, the data obtained by the first transaction will be invalid.</p></blockquote>
<p><strong>What is Nonrepeatable read?</strong></p>
<blockquote><p>Nonrepeatable reads happen when a transaction performs the same query two or more times and each time the data is different. This is usually due to another concurrent transaction updating the data between the queries.</p></blockquote>
<p><strong>What is a lost update problem?</strong></p>
<blockquote><p>Lost updates occur when two or more transactions select the same row and then update the row based on the value originally selected. Each transaction is unaware of other transactions. The last update overwrites updates made by the other transactions, which results in lost data.</p></blockquote>
<p><strong>What is Timeout?</strong></p>
<blockquote data-secret="mv0SEDiAHt" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2016/04/database-theory-what-is-timeout-lock-block-and-deadlock-in-a-database-system/">Database Theory: What is Timeout, Lock, Block, and Deadlock in a Database System?</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/04/database-theory-what-is-timeout-lock-block-and-deadlock-in-a-database-system/embed/#?secret=mv0SEDiAHt" data-secret="mv0SEDiAHt" width="600" height="338" title="&#8220;Database Theory: What is Timeout, Lock, Block, and Deadlock in a Database System?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What is a Lock?</strong></p>
<blockquote><p>When one process is accessing an object, it can request for a lock for that particular object so that other processes cannot perform read or update on that object.</p>
<p>There are different types of lock like: Exclusive Lock, Non-exclusive Lock.</p></blockquote>
<p><strong>What is Blocking?</strong></p>
<blockquote><p>If two processes are accessing same resource so at that time one process has to wait until the other process release the occupied resource.</p>
<p>This is called blocking because one transaction is blocked by another transaction and all blocked processes kept in the waiting queue.</p>
<p>If the blocked transaction is waiting for a long time, it may generate a Database Timeout. If the long running blocked transaction requires a lock, it may generate a Database Deadlock.</p></blockquote>
<p><strong>What is a Deadlock?</strong></p>
<blockquote><p>One X blocked process is waiting to complete the transaction of the Y process and the same time, Y process is blocked because it is also waiting to complete the transaction of the X process.</p>
<p>This is called as Deadlock situation.</p>
<p>Deadlock is a next stage of the blocking situation so if you want to avoid Deadlock situation, you should first find the blocked transaction and tried to remove internal dependency of the transactions.</p></blockquote>
<p><strong>What is a Live lock?</strong></p>
<blockquote><p>A livelock is one, where a request for an exclusive lock is repeatedly denied because a series of overlapping shared locks keeps interfering. SQL Server detects the situation after four denials and refuses further shared locks. A livelock also occurs when read transactions monopolize a table or page, forcing a write transaction to wait indefinitely.</p></blockquote>
<p><strong>What is Optimistic Locking and Pessimistic Locking?</strong></p>
<blockquote data-secret="i6i2DG1tfR" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2016/04/database-theory-what-is-optimistic-locking-and-pessimistic-locking/">Database Theory: What is Optimistic Locking and Pessimistic Locking?</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/04/database-theory-what-is-optimistic-locking-and-pessimistic-locking/embed/#?secret=i6i2DG1tfR" data-secret="i6i2DG1tfR" width="600" height="338" title="&#8220;Database Theory: What is Optimistic Locking and Pessimistic Locking?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What are the different ways to detect a deadlock in the SQL Server?</strong></p>
<blockquote data-secret="vINK5fCe3u" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2016/04/sql-server-8-different-ways-to-detect-a-deadlock-in-a-database/">SQL Server: 8 different ways to Detect a DeadLock in a Database</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/04/sql-server-8-different-ways-to-detect-a-deadlock-in-a-database/embed/#?secret=vINK5fCe3u" data-secret="vINK5fCe3u" width="600" height="338" title="&#8220;SQL Server: 8 different ways to Detect a DeadLock in a Database&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What happens after the Deadlock arise in the SQL Server?</strong></p>
<blockquote data-secret="Hkr0ZTvzXa" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2016/04/sql-server-what-happens-after-the-deadlock-arise/">SQL Server: What happens after the Deadlock arise?</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/04/sql-server-what-happens-after-the-deadlock-arise/embed/#?secret=Hkr0ZTvzXa" data-secret="Hkr0ZTvzXa" width="600" height="338" title="&#8220;SQL Server: What happens after the Deadlock arise?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What is your ultimate strategies to avoid a Deadlock?</strong></p>
<blockquote data-secret="xedNE0qwWw" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2016/04/database-design-the-ultimate-strategies-to-avoid-deadlock/">Database Design: The Ultimate Strategies to avoid Deadlock</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/04/database-design-the-ultimate-strategies-to-avoid-deadlock/embed/#?secret=xedNE0qwWw" data-secret="xedNE0qwWw" width="600" height="338" title="&#8220;Database Design: The Ultimate Strategies to avoid Deadlock&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>What is the Database level Locking?</strong></p>
<blockquote><p>With database level locks, the entire database is locked – which means that only one database session can apply any updates to the database. This type of lock is not often used, because it obviously prevents all users except one from updating anything in the database.</p></blockquote>
<p><strong>What is the File level Locking?</strong></p>
<blockquote><p>With a file lock level, an entire database file is locked. What exactly is a file in a database? Well, a file can have a wide variety of data – inside a file there could be an entire table, a part of a table, or even parts of different tables. Because of the variety of data stored inside a file, this type of lock level is less favored.</p></blockquote>
<p><strong>What is the Column level Locking?</strong></p>
<blockquote><p>A column level lock just means that some columns within a given row in a given table are locked. This form of locking is not commonly used because it requires a lot of resources to enable and release locks at this level. Also, there is very little support for column level locking in most database vendors.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/06/sql-server-database-lock-deadlock-block-and-isolation-interview-questions-and-answers-day-1/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: What is Read Uncommitted Isolation Level?</title>
		<link>https://www.dbrnd.com/2016/04/sql-server-what-is-read-uncommitted-isolation-level/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 02 Apr 2016 19:47:21 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Dirty read]]></category>
		<category><![CDATA[READ UNCOMMITTED Isolation]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2219</guid>

					<description><![CDATA[The Read Uncommitted Isolation level permits you to read uncommitted data. The transaction is completed or not, it doesn&#8217;t matter because It has never issued the share locks and it allows other transactions to modify data that you are reading. Anytime you can read your data without any locking issues, but sometimes it generates unexpected [&#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%2Fsql-server-what-is-read-uncommitted-isolation-level%2F&amp;linkname=SQL%20Server%3A%20What%20is%20Read%20Uncommitted%20Isolation%20Level%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%2Fsql-server-what-is-read-uncommitted-isolation-level%2F&amp;linkname=SQL%20Server%3A%20What%20is%20Read%20Uncommitted%20Isolation%20Level%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%2Fsql-server-what-is-read-uncommitted-isolation-level%2F&amp;linkname=SQL%20Server%3A%20What%20is%20Read%20Uncommitted%20Isolation%20Level%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%2Fsql-server-what-is-read-uncommitted-isolation-level%2F&amp;linkname=SQL%20Server%3A%20What%20is%20Read%20Uncommitted%20Isolation%20Level%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%2Fsql-server-what-is-read-uncommitted-isolation-level%2F&amp;linkname=SQL%20Server%3A%20What%20is%20Read%20Uncommitted%20Isolation%20Level%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%2Fsql-server-what-is-read-uncommitted-isolation-level%2F&amp;linkname=SQL%20Server%3A%20What%20is%20Read%20Uncommitted%20Isolation%20Level%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%2Fsql-server-what-is-read-uncommitted-isolation-level%2F&#038;title=SQL%20Server%3A%20What%20is%20Read%20Uncommitted%20Isolation%20Level%3F" data-a2a-url="https://www.dbrnd.com/2016/04/sql-server-what-is-read-uncommitted-isolation-level/" data-a2a-title="SQL Server: What is Read Uncommitted Isolation Level?"></a></p><p>The Read Uncommitted Isolation level permits you to read uncommitted data.</p>
<p>The transaction is completed or not, it doesn&#8217;t matter because It has never issued the share locks and it allows other transactions to modify data that you are reading. </p>
<blockquote><p>Anytime you can read your data without any locking issues, but sometimes it generates unexpected results because the data returned by the SELECT are dirty data or in a half state only. </p></blockquote>
<p>Below is a small demonstration to read uncommitted data. </p>
<p><strong>Now, test this READ UNCOMMITTED isolation level:</strong></p>
<p><strong>First, create a table with sample data:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Employee
(
	EmpID INTEGER
	,EmpName VARCHAR(50)
)
GO
 
INSERT INTO tbl_Employee
VALUES 
(1,'Anvesh'),(2,'Neevan')
,(3,'Roy'),(4,'Martin')
GO</pre> </p>
<p><strong>Open a new query window or session and executing below script:</strong></p>
<pre class="crayon-plain-tag">BEGIN TRANSACTION
	UPDATE tbl_Employee SET EmpName ='Jenny' WHERE EmpID=1
	WAITFOR DELAY '00:00:15'  
COMMIT</pre> </p>
<p><strong>During the delay of 15 seconds, Open a new query window or session and try to SELECT this table under READ UNCOMMITED isolation level:</strong></p>
<pre class="crayon-plain-tag">SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED  
SELECT *FROM tbl_Employee</pre> </p>
<p>Now, you can SELECT Uncommitted data.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
