<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="2" MadCap:lastHeight="120" MadCap:lastWidth="624" MadCap:disableMasterStylesheet="true" MadCap:tocPath="Basics Operations & Concepts|ACID Properties And Transactions" MadCap:InPreviewMode="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" MadCap:PathToHelpSystem="../../../" MadCap:HelpSystemFileName="index.xml" MadCap:SearchType="Stem"> <head><title>Isolation</title> <script type="text/javascript">/* <![CDATA[ */ window.onload = function(){ var pathToFlash = $('html').attr('MadCap:PathToHelpSystem') + 'Content/Resources/Code/ZeroClipboard.swf'; ZeroClipboard.setMoviePath(pathToFlash); function bindToClipBord(element,content){ var clip = new ZeroClipboard.Client(); clip.setText(content); clip.glue(element); }; if(location.protocol==='file:'){ $('.copylink-marker').remove(); } else{ $('.copylink-marker').each(function(){ var text = $(this).parent().parent().children('.prettyprint').html(); $(this).hover(function(){ bindToClipBord(this,text); }, function(){}); }); } prettyPrint(); }; /* ]]> */</script> <link href="../../SkinSupport/MadCap.css" rel="stylesheet" /> <link href="../../Resources/Stylesheets/OnlineStyle.css" rel="stylesheet" /> <script src="../../Resources/Code/prettify.js"> </script> <script src="../../Resources/Code/lang-vb.js"> </script> <script src="../../Resources/Code/jquery.min.js"> </script> <script src="../../Resources/Code/ZeroClipboard.js"> </script> <script src="../../SkinSupport/MadCapAll.js" type="text/javascript"> </script> </head> <body> <p class="MCWebHelpFramesetLink" style="display: none;"><a href="../../../index_CSH.html#basics/acid_and_transactions/isolation.htm" style="">Open topic with navigation</a> </p> <div class="MCBreadcrumbsBox"><span class="MCBreadcrumbsPrefix">You are here: </span><a class="MCBreadcrumbsLink" href="../../basics.htm">Basics Operations & Concepts</a><span class="MCBreadcrumbsDivider"> > </span><a class="MCBreadcrumbsLink" href="../acid_and_transactions.htm">ACID Properties And Transactions</a><span class="MCBreadcrumbsDivider"> > </span><span class="MCBreadcrumbs">Isolation</span> </div> <p> <script type="text/javascript">/*<![CDATA[*/document.write('<a href="' + location.href +'">'); document.write("Direct Link"); document.write('</a>');/*]]>*/</script> </p> <p> </p> <h1><a name="kanchor23"></a>Isolation</h1> <p>Isolation imposes rules which ensure that transactions do not interfere with each other even if they are executed at the same time. If two or more transactions are executed at the same time, they must be executed in a way so that transaction A won't be impacted by the intermediate data of transaction B. Note that isolation does not dictate the order of the transactions. Another important thing to understand about isolation is serializability of transactions. If the effect on the database is the same when transactions are executed concurrently or when their execution is interleaved, these transactions are called serializable.</p> <p>There are several degrees of isolation to be distinguished:</p> <ul> <li value="1">Degree 0: A transaction does not overwrite data updated by another user or process ("dirty data") of other transactions.</li> <li value="2">Degree 1: Degree 0 plus a transaction does not commit any writes until it completes all its writes (until the end of transaction).</li> <li value="3">Degree 2: Degree 1 plus a transaction does not read dirty data from other transactions.</li> <li value="4">Degree 3: Degree 2 plus other transactions do not dirty data read by a transaction before the transaction commits.</li> </ul> <p>The more common classification is by isolation levels:</p> <ol> <li value="1"><strong>Serializable</strong>: In this case, transactions are executed serially so that there is no concurrent data access. Transactions can also be executed concurrently but only when the illusion of serial transactions is maintained (i.e. no concurrent access to data occurs). If the system uses locks, a lock should be obtained over the whole range of selected data. If the system does not use locks, no lock is acquired; however, if the system detects a concurrent transaction in progress, which would violate the serializability illusion, it must force that transaction to rollback, and the application will have to restart the transaction.</li> <li value="2"><strong>Repeatable Read</strong>: In this case, a lock is acquired over all the data retrieved from a database. Phantom reads can occur (i.e. new data from the other committed transactions included in the result)</li> <li value="3"><strong>Read Committed</strong>: In this case, read locks are acquired on the result set, but released immediately. Write locks are acquired and released only at the end of the transaction. Non-repeatable reads can occur, i.e. deletions or modifications from the other committed transactions will be visible by the current transaction. Phantom reads are also possible. This is the model db4o uses.</li> <li value="4"><strong>Read Uncommitted</strong>: With this isolation level dirty reads are allowed. Uncommitted modifications from the other transactions are visible. Both phantom and nonrepeatable reads can occur.</li> </ol> <p>Read more about <a href="http://en.wikipedia.org/wiki/Isolation_level" target="_parent">isolation levels on Wikipedia</a>. </p> <script type="text/javascript" src="../../SkinSupport/MadCapBodyEnd.js"> </script> </body> </html>