<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Microsoft SQL Server Development Customer Advisory Team</title><link>http://blogs.msdn.com/b/sqlcat/</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 5.6.583.19849 (Build: 5.6.583.19849)</generator><item><title>Helping to make Hadoop easier by going Metro!</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/12/14/helping-to-make-hadoop-easier-by-going-metro.aspx</link><pubDate>Wed, 14 Dec 2011 18:27:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10247732</guid><dc:creator>Denny Lee [MSFT]</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10247732</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/12/14/helping-to-make-hadoop-easier-by-going-metro.aspx#comments</comments><description>&lt;p&gt;We are proud to announce that the community technology preview (CTP) of Apache&lt;sup&gt;TM&lt;/sup&gt; Hadoop&lt;sup&gt;TM&lt;/sup&gt;-based Services for Windows Azure (or Hadoop on Azure) is now available. As noted in on the SQL Server Data Platform Insider blog, the CTP is by invite only &lt;a href="http://blogs.technet.com/b/dataplatforminsider/archive/2011/12/14/availability-of-community-technology-preview-ctp-of-hadoop-based-service-on-windows-azure.aspx"&gt;http://blogs.technet.com/b/dataplatforminsider/archive/2011/12/14/availability-of-community-technology-preview-ctp-of-hadoop-based-service-on-windows-azure.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;While Hadoop is important to our customers for performance, scalability, and extreme volumes - as noted in our blog &lt;a href="http://sqlcat.com/sqlcat/b/msdnmirror/archive/2011/11/14/what-s-so-big-about-big-data.aspx"&gt;What&amp;rsquo;s so BIG about &amp;ldquo;Big Data&amp;rdquo;?&lt;/a&gt; &amp;ndash; it is a slight paradigm shift for our us in the SQL community. &amp;nbsp;&amp;nbsp;Therefore, one of the great things about our new Hadoop on Azure service is that we&amp;rsquo;ve made Hadoop go all Metro &amp;ndash; that is a Metro UI with a Live Tile implementation.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/8738.iPad-Hadoop-on-Azure-Metro-UI.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/8738.iPad-Hadoop-on-Azure-Metro-UI.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/8738.iPad-Hadoop-on-Azure-Metro-UI.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What is even cooler is that you can interact with with Hadoop, Hive, Pig-Latin, Hadoop Javascript framework, Azure DataMarket, and Excel using the Hadoop on Azure service &amp;ndash; check out the&amp;nbsp;Channel 9 video for Hadoop on Azure at: &lt;a href="http://video.ch9.ms/ch9/6dc7/9022c2d7-e779-453c-bd82-9fb7017a6dc7/HadoopOnWindowsAzure_med_ch9.mp4"&gt;http://video.ch9.ms/ch9/6dc7/9022c2d7-e779-453c-bd82-9fb7017a6dc7/HadoopOnWindowsAzure_med_ch9.mp4&lt;/a&gt; for more information.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re really excited about this CTP &amp;ndash; so if you want an invite code, please check out the fill out the Connect survey: &lt;a href="http://connect.microsoft.com/SQLServer/Survey/Survey.aspx?SurveyID=13697"&gt;http://connect.microsoft.com/SQLServer/Survey/Survey.aspx?SurveyID=13697&lt;/a&gt; (you may have to copy/paste this link).&amp;nbsp; Invite codes will be given out based on a selection criteria basis so please be patient.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;As well, check out all of the great documentation and content so you can keep up to date on Hadoop on Azure:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Apache Hadoop on Windows Resources:&amp;nbsp;&lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/apache-hadoop-on-windows.aspx"&gt;http://social.technet.microsoft.com/wiki/contents/articles/apache-hadoop-on-windows.aspx&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Microsoft Hadoop Distribution Documentation Plan:&amp;nbsp;&lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/microsoft-hadoop-distribution-documentation-plan.aspx"&gt;http://social.technet.microsoft.com/wiki/contents/articles/microsoft-hadoop-distribution-documentation-plan.aspx&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Apache Hadoop-based Services for Windows Azure How-To and FAQ Guide:&amp;nbsp;&lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/apache-hadoop-based-services-for-windows-azure-how-to-and-faq-guide.aspx"&gt;http://social.technet.microsoft.com/wiki/contents/articles/apache-hadoop-based-services-for-windows-azure-how-to-and-faq-guide.aspx&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;Isotope PG and CX teams&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10247732" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Big+Data/">Big Data</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Hadoop/">Hadoop</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Azure/">Azure</category></item><item><title>A Computed Column Defined with a User-Defined Function Might Impact Query Performance</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/11/28/a-computed-column-defined-with-a-user-defined-function-might-impact-query-performance.aspx</link><pubDate>Mon, 28 Nov 2011 22:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10242176</guid><dc:creator>Kun Cheng</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10242176</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/11/28/a-computed-column-defined-with-a-user-defined-function-might-impact-query-performance.aspx#comments</comments><description>&lt;p&gt;&lt;b&gt;Author: Kun Cheng&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Reviewers: Shaun Tinline-Jones, Silvano Coriani, Steve Howard, Thomas Kejser, Sanjay Mishra&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;A computed column is computed from an expression that can use other columns in the same table. The expression can be a noncomputed column name, constant, function, and any combination of these connected by one or more operators, but the expression cannot be a subquery. A simple example of a computed column is:&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="213"&gt;
&lt;p&gt;Col1&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="213"&gt;
&lt;p&gt;Col2&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="213"&gt;
&lt;p&gt;Computed_Col=(Col1+Col2)&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="213"&gt;
&lt;p&gt;100&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="213"&gt;
&lt;p&gt;100&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="213"&gt;
&lt;p&gt;200&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;A benefit of using computed columns is that they can save developers from having to write calculation logic at the application layer; at the table level, the application can simply reference the computed column. In addition, performance can be improved by persisting a computed column and building an index on it (see &amp;ldquo;&lt;a href="http://msdn.microsoft.com/en-us/library/ms189292.aspx"&gt;Creating Indexes on Computed Columns&lt;/a&gt;&amp;rdquo; at&amp;nbsp; &lt;a href="http://msdn.microsoft.com/en-us/library/ms189292.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms189292.aspx&lt;/a&gt;). In real-world scenarios (unlike the simple example above), a common way to define a computed column is by using a user-defined function (UDF) to encapsulate the calculation logic. For example, the script below uses an XQuery expression to extract a summary description as a computed column out of the XML data, which is stored in another column of the same table. Once the computed column is persisted to the physical storage of the table, we can build an index on top of it to speed up queries that access the computed column.&lt;/p&gt;
&lt;pre class="scroll"&gt;&lt;code class="mysql"&gt;CREATE FUNCTION udf_compcol(@contents XML) &lt;br /&gt; RETURNS nvarchar(255)&lt;br /&gt; WITH SCHEMABINDING &lt;br /&gt; BEGIN&lt;br /&gt; RETURN @contents.value('(/item/description/text())[1]', 'nvarchar(255)')&lt;br /&gt; END &lt;br /&gt;Go&lt;br /&gt;ALTER TABLE Books&lt;br /&gt; ADD summary_compcol AS udf_compcol(Contents) PERSISTED&lt;br /&gt;Go&lt;br /&gt;CREATE INDEX ix_Books_summary ON Books(summary_compcol)&lt;br /&gt;Go &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this example, we are promoting the &amp;ldquo;description&amp;rdquo; element out of the XML data to a relational column for performance gain, because querying against XML semi-structured data is slower than querying against structured data. However, the computed column might behave in an unexpected way that can impact query performance. One example of this unexpected behavior is discussed in the blog post &amp;ldquo;&lt;a href="http://sqlcat.com/sqlcat/b/msdnmirror/archive/2011/09/01/quoted-identifier-causes-unexpected-query-plan-for-persisted-computed-column-query.aspx"&gt;Query Plan for Persisted Computed Column Query&lt;/a&gt;&amp;rdquo; at &amp;nbsp;&lt;a href="http://sqlcat.com/sqlcat/b/msdnmirror/archive/2011/09/01/quoted-identifier-causes-unexpected-query-plan-for-persisted-computed-column-query.aspx"&gt;http://sqlcat.com/sqlcat/b/msdnmirror/archive/2011/09/01/quoted-identifier-causes-unexpected-query-plan-for-persisted-computed-column-query.aspx&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In this blog post, I will describe another unexpected behavior of computed column that occurs in a different scenario. On a multi-core server, which is typical for a SQL Server environment, the following XQuery generates a parallel plan as it scans the XML data.&lt;/p&gt;
&lt;pre class="scroll"&gt;&lt;code class="mysql"&gt;SELECT title FROM Books WHERE Books.Contents.exist(N'/item/isbn[.=7646309]') = 1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/2625.plan3.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/2625.plan3.jpg" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/5265.plan1.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;With the addition of the computed column defined by the UDF udf_compcol, the same query generates a sequential plan, which is identical to the original plan except it is not parallel.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/8231.plan4.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/8231.plan4.jpg" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/8422.plan2.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The reason that the query generates a sequential plan in this case is that when SQL Server compiles a query plan, it loads all referenced column expressions and determines if there is a UDF associated with any computed column(s). If there is, SQL Server disables the parallel plan and generates only a sequential plan. This is what happened with our query, which referenced a table containing a computed column defined with a UDF. Note the behavior is the same regardless of whether computed column is persisted or not.&lt;/p&gt;
&lt;p&gt;In this case, we were able to tune the query by promoting the &amp;ldquo;/item/isbn&amp;rdquo; element out of the XML data to another relational column so the query didn&amp;rsquo;t need to scan the table in the first place.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here are some general recommendations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use computed columns wisely, and evaluate their performance impact with comprehensive testing against an established baseline.&lt;/li&gt;
&lt;li&gt;If possible, use Transact-SQL instead of UDFs to define computed columns.&lt;/li&gt;
&lt;li&gt;When promoting elements out of XML data to computed columns, a UDF is required. Consider tuning the impacted queries with XML indexes or promoting the referenced elements to relational column(s).&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10242176" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/sql/">sql</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/XML/">XML</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/UDF/">UDF</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/computed+column/">computed column</category></item><item><title>Writing New Hash Functions for SQL Server</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/11/28/writing-new-hash-functions-for-sql-server.aspx</link><pubDate>Mon, 28 Nov 2011 14:21:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10242006</guid><dc:creator>Thomas Kejser</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10242006</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/11/28/writing-new-hash-functions-for-sql-server.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;Author: &lt;/strong&gt;Thomas Kejser&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Contributors/Reviewers: &lt;/strong&gt;Alexei Khalyako, Jerome Halmans, Fabricio Voznika, Sedat Yogurtcuoglu, Mike Ruthruff, Tobias Ternstrom and Steve Howard&lt;/p&gt;  &lt;p&gt;In this blog, I will explore ideas for extending SQL Server with new, fast hash functions. As will be shown, the high speed, built in functions CHECKSUM and BINARY_CHECKSUM are not always optimal hash functions, when you require the function to spread data evenly over an integer space. I will show that it can be useful to extend SQL Server with a new CLR User Defined Function (UDF).&lt;/p&gt;  &lt;p&gt;In distributed workloads, hashing a columns in the data and evenly distributing the hash value into buckets, is often a good way to evenly scale work over multiple scale units (either machines or NUMA nodes). In such an architecture, each scale-unit will be responsible for handling a subset of the total buckets. Achieving a good distribution in hash buckets will depend on the skew of the input data, but also on how well the hash function behaves on the input. &lt;/p&gt;  &lt;p&gt;In this blog, I will use a simple input table to test the properties of different hash functions. For my example, let us imagine that the input values is 10M customer keys that have been generated either by a SQL Server 2010 SEQUENCER or an IDENTITY(1,1) column with no holes in the sequence. This table can be created like this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;CREATE TABLE CustKey (SK INT NOT NULL)&lt;/strong&gt;&lt;/p&gt;   &lt;strong&gt;&lt;/strong&gt;    &lt;p&gt;&lt;strong&gt;INSERT INTO CustKey WITH (TABLOCK) (SK)        &lt;br /&gt;SELECT n FROM dbo.fn_nums(10000000)         &lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;/blockquote&gt;  &lt;p&gt;&lt;em&gt;(The fn_nums function can be found &lt;/em&gt;&lt;a href="http://www.sqlmag.com/article/tsql3/auxiliary-table-of-numbers-tricks"&gt;&lt;em&gt;here&lt;/em&gt;&lt;/a&gt;&lt;em&gt;)&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;In this test, the input has no skew, and I will assume that we want to split the input into 65536 approximately equal sized hash bucket, spread all over the 16-bit integer space, as the desired output of the hash function. This means that ideally, the output will have 152 values (10M / 65536) in each bucket. &lt;/p&gt;  &lt;p&gt;In other words: we are trying to achieve a mapping between a sequence of values in the 32-bit integer space to an evenly spread out, 16-bit integer space like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/4643.image_5F00_4BC35F43.png"&gt;&lt;img style="border: 0px currentcolor; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/5557.image_5F00_thumb_5F00_0A48ACEA.png" width="387" height="261" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;For convenience, I will use 64K = 65536 and 32K = 32768 below.&lt;/p&gt;  &lt;h2&gt;Using CHECKSUM and BINARY_CHECKSUM&lt;/h2&gt;  &lt;p&gt;The built in functions CHECKSUM and BINARY_CHECKSUM both operate on any input and return a 32-bit, signed integer (SQL type: int). By integer dividing the output by 64K we can split the integer space into the 64K buckets we want.&lt;/p&gt;  &lt;p&gt;With the following query, we can get a rough idea of the distribution in the buckets:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;WITH Input (bucket, bucket_count) AS        &lt;br /&gt;(         &lt;br /&gt;&amp;#160; SELECT BINARY_CHECKSUM(SK) / 65536 as bucket         &lt;br /&gt;&amp;#160;&amp;#160; , COUNT(*) as bucket_count&amp;#160; &lt;br /&gt;&amp;#160; FROM CustKey        &lt;br /&gt;&amp;#160; GROUP BY BINARY_CHECKSUM(SK) / 65536         &lt;br /&gt;)         &lt;br /&gt;SELECT MIN(bucket_count)         &lt;br /&gt;&amp;#160; , MAX(bucket_count)         &lt;br /&gt;&amp;#160; , COUNT(*) filled_buckets         &lt;br /&gt;&amp;#160; , SUM(bucket_count)         &lt;br /&gt;FROM Input         &lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;/blockquote&gt;  &lt;p&gt;Running this for both BINARY_CHECKSUM and CHECKSUM, I get:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/6710.image_5F00_243C6D0C.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/0842.image_5F00_thumb_5F00_2E8D916C.png" width="337" height="78" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This does not look promising, we would expect the min/max to linger around 152 and the number of filled buckets to be 64K. Books Online does &lt;a href="http://msdn.microsoft.com/en-us/library/ms173784.aspx"&gt;state&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;[…] we do not recommend using CHECKSUM to detect whether values have changed, unless your application can tolerate occasionally missing a change. Consider using &lt;/em&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms174415.aspx"&gt;&lt;em&gt;HashBytes&lt;/em&gt;&lt;/a&gt;&lt;em&gt; instead. When an MD5 hash algorithm is specified, the probability of HashBytes returning the same result for two different inputs is much lower than that of CHECKSUM.&lt;/em&gt;&lt;/p&gt;  &lt;/blockquote&gt;  &lt;p&gt;So, it seems we should use HASHBYTES.&lt;/p&gt;  &lt;h2&gt;Using HASHBYTES&lt;/h2&gt;  &lt;p&gt;HASHBYTES with MD5 returns a 160 bit value. We can turn this into 64K buckets by taking modulo 32K on the output. We can now write&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;WITH Input (bucket, bucket_count) AS        &lt;br /&gt;(         &lt;br /&gt;&amp;#160; SELECT HASHBYTES('MD5', CAST(SK AS VARBINARY)) % 32768 as bucket         &lt;br /&gt;&amp;#160;&amp;#160; , COUNT(*) as bucket_count&amp;#160; &lt;br /&gt;&amp;#160; FROM CustKey        &lt;br /&gt;&amp;#160; GROUP BY HASHBYTES('MD5', CAST(SK AS VARBINARY)) % 32768         &lt;br /&gt;)         &lt;br /&gt;SELECT MIN(bucket_count)         &lt;br /&gt;&amp;#160; , MAX(bucket_count)         &lt;br /&gt;&amp;#160; , COUNT(*) filled_buckets         &lt;br /&gt;&amp;#160; , SUM(bucket_count)         &lt;br /&gt;FROM Input&lt;/strong&gt;&lt;/p&gt;  &lt;/blockquote&gt;  &lt;p&gt;As I run this, I notice that it take very long to run. But the output is quite good compared to BINARY_CHECKSUM and CHECKSUM:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/8875.image_5F00_2629BC15.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/8688.image_5F00_thumb_5F00_00BFC8A7.png" width="354" height="103" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;To benchmark the speed of the hash function, we need to write this little script that minimizes the transmission time to the client:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;SET STATISTICS TIME ON&lt;/strong&gt;&lt;/p&gt;   &lt;strong&gt;&lt;/strong&gt;    &lt;p&gt;&lt;strong&gt;SELECT MAX(bucket)        &lt;br /&gt;FROM(         &lt;br /&gt;&amp;#160; SELECT HASHBYTES('MD5', CAST(SK AS VARBINARY)) % 32768 as bucket         &lt;br /&gt;&amp;#160; FROM CustKey        &lt;br /&gt;) AS input         &lt;br /&gt;OPTION (MAXDOP 1)&lt;/strong&gt;&lt;/p&gt;  &lt;/blockquote&gt;  &lt;p&gt;On my machine, the CPU time is around 14 seconds, about one millisecond per hash calculation. Note that MD5 has cryptographic properties that we may not need. Are we paying too high an overhead for this? I tested with the other hash functions in HASHBYTES, and all of them take a lot of CPU per hash calculation&lt;/p&gt;  &lt;h2&gt;Building a SQLCLR function on Binary data&lt;/h2&gt;  &lt;p&gt;At this point, it seems natural to ask if there is a way to write our own hash function. Fortunately, SQL server provides a great way to extend the engine with new functionality: SQLCLR. &lt;/p&gt;  &lt;p&gt;In order to explore this option, I wanted to quantify the cost of marshaling data from SQL to CLR, this simple function was my initial test:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/7128.image_5F00_23345762.png"&gt;&lt;img style="border: 0px currentcolor; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/3414.image_5F00_thumb_5F00_0FA6F7C1.png" width="584" height="88" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Running the performance test above, I saw a shocking 56 seconds, just to return an integer!&lt;/p&gt;  &lt;p&gt;At times like these, it is very useful to run &lt;strong&gt;xperf&lt;/strong&gt;, I ran the following command line before starting the test again:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;xperf –on latency –stackwalk profile&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;/blockquote&gt;  &lt;p&gt;After about one minute, when the test was done, I ran:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;xperf –d C:\dumps\nohash_trace.etl&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;/blockquote&gt;  &lt;p&gt;This allows me to quantify all the CPU time spend in SQL server, the result was very interesting. On my 4 core machine, the single threaded execution (25% of the CPU) breaks down like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/5557.image_5F00_74FA5BA7.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/5148.image_5F00_thumb_5F00_7EDF4D12.png" width="562" height="83" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;With a properly configured symbol path, we can actually zoom into &lt;strong&gt;sqlservr.exe&lt;/strong&gt; and see what is going on (you can do this too, it does not require source code access – see this link on how to get started)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/4064.image_5F00_1CDD5B07.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/1732.image_5F00_thumb_5F00_28FED52E.png" width="573" height="246" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;UDFInvokeExternal &lt;/strong&gt;sounds like the call that wraps my CLR. But wait a minute. What are those &lt;strong&gt;UrtReadLob&lt;/strong&gt;, &lt;strong&gt;UrtGetLobLength &lt;/strong&gt;and &lt;strong&gt;ExecUdfLobAccess &lt;/strong&gt;in there? They add up to more than the time taken for the highest CPU consumer (&lt;strong&gt;GetNextRowValuesInternal&lt;/strong&gt;).&lt;/p&gt;  &lt;p&gt;Looking up &lt;a href="http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlbytes.aspx"&gt;SqlBytes&lt;/a&gt; on MSDN, we find:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;“Represents a mutable reference type that wraps either a &lt;/em&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlbytes.buffer.aspx"&gt;&lt;em&gt;Buffer&lt;/em&gt;&lt;/a&gt;&lt;em&gt; or a &lt;/em&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlbytes.stream.aspx"&gt;&lt;em&gt;Stream&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.”&lt;/em&gt;&lt;/p&gt;  &lt;/blockquote&gt;  &lt;p&gt;This doesn’t sound like the type I wanted: buffer and streams – perhaps this is where LOB’ish calls are from? My next attempt replaces SqlBytes with SqlBinary:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/1348.image_5F00_16F291A1.png"&gt;&lt;img style="border: 0px currentcolor; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/8765.image_5F00_thumb_5F00_711C6B3D.png" width="606" height="88" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Runtime with the new data type: 7 seconds. A factor 8 improvement! This is also faster than the HASHBYTES run. If I could come up with a hash function that has a good spread, but which is cheaper than MD5…&lt;/p&gt;  &lt;h2&gt;Testing CRC32 and CRC16&lt;/h2&gt;  &lt;p&gt;Fortunately, the field of computer science is full of work about hash functions and you can pick one that fits your needs. Two easy to implement functions are CRC32 and CRC16. You can find reference implementation in Wikipedia.&lt;/p&gt;  &lt;p&gt;CRC32 returns a 32-bit integer, and we can turn it into the 64K buckets by dividing with 64K. CRC16 on the other hand, returns exactly what we want.&lt;/p&gt;  &lt;p&gt;Without further ado, here are the results I obtained by writing my own hash CRC16/32 function:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/4666.image_5F00_124C611A.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01-metablogapi/3580.image_5F00_thumb_5F00_174E9EC9.png" width="477" height="152" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Conclusion&lt;/h2&gt;  &lt;p&gt;If you need hash functions that spread data evenly over an integer space, you have to choose the hash function carefully. The built in hash functions BINARY_CHECKSUM and CHECKSUM, while very fast, do not provide a good spread over a 16 bit integer space. The built in SQL Server HASHBYTES offers good spread over the the space, but comes a high computation cost.&lt;/p&gt;  &lt;p&gt;If you do not need the cryptographic properties of the HASHBYTES function, you can consider writing your own SQLCLR function to calculate hash values. With a properly chosen hash algorithm, and by avoiding the &lt;strong&gt;SqlBytes&lt;/strong&gt; data type, you can hash values faster than HASHBYTES, while maintaining the benefits of a good spread over the integer space.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10242006" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Query+performance/">Query performance</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/T_2D00_SQL/">T-SQL</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/UDF/">UDF</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/User+Defined+Functions/">User Defined Functions</category></item><item><title>What’s so BIG about “Big Data”?</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/11/15/what-s-so-big-about-big-data.aspx</link><pubDate>Tue, 15 Nov 2011 05:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10237129</guid><dc:creator>Denny Lee [MSFT]</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10237129</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/11/15/what-s-so-big-about-big-data.aspx#comments</comments><description>&lt;p&gt;As announced during the &lt;a title="PASS Summit 2011 Day One Keynote" href="http://www.sqlpass.org/summit/2011/Live/LiveStreaming/LiveStreamingWednesday.aspx" target="_blank"&gt;PASS Summit 2011 Day One Keynote&lt;/a&gt;, we are diving deeper into the world of Big Data by embracing and contributing to the open source community and Hadoop.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ve had a lot of good coverage on this topic with some examples below.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="Microsoft Expands Data Platform With SQL Server 2012, New Investments for Managing Any Data, Any Size, Anywhere" href="http://www.microsoft.com/Presspass/press/2011/oct11/10-12PASS1PR.mspx?rss_fdn=Custom" target="_blank"&gt;Microsoft Expands Data Platform With SQL Server 2012, New Investments for Managing Any Data, Any Size, Anywhere&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a title="Microsoft makes its move with Hadoop on Azure and Windows Server" href="http://arstechnica.com/business/news/2011/10/microsoft-makes-its-move-with-hadoop-on-azure-and-windows-server.ars" target="_blank"&gt;Microsoft makes its move with Hadoop on Azure and Windows Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a title="Hortonworks, Microsoft Sign Co-Development Deal for Hadoop" href="http://www.eweek.com/c/a/Windows/Hortonworks-Microsoft-Sign-CoDevelopment-Deal-for-Hadoop-453211/" target="_blank"&gt;Hortonworks, Microsoft Sign Co-Development Deal for Hadoop&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Openness &amp;ndash; yes, we&amp;rsquo;re serious about it!&lt;/h3&gt;
&lt;p&gt;&lt;br /&gt;A key aspect is openness and our commitment to give back to the Open Source community.&amp;nbsp; While this is just a small start, we made a first step forward with SQL Community ambassadors Lara Rubbelke (@sqlgal) and Bronwyn McNutt (@MissBronwyn) leading the effort at one of the ultimate open source conference &amp;ndash; &lt;a title="ApacheCon North America 2011" href="http://na11.apachecon.com/" target="_blank"&gt;ApacheCon North America 2011&lt;/a&gt;.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hadoop on Azure / Windows Server Founder and General Manager Alexander Stojanovic (@stojanovic), Dave Vronay (@davevr), and I had also joined the festivities to introduce ourselves and listen to the Apache community (and we learned a lot!).&amp;nbsp; Luis Daniel (@luisdans) from our product planning team also joined &amp;ndash; this is just the beginning but should show our commitment to openness!&amp;nbsp;&amp;nbsp; More to come on that in future blog posts.&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;@dsfnet had appropriately tweeted&amp;nbsp; &lt;a href="mailto:&amp;ldquo;@dennylee"&gt;&amp;ldquo;@dennylee&lt;/a&gt; You are really taking this Hadoop/Apache thing to heart :)&amp;rdquo;.&amp;nbsp; &lt;br /&gt;Yes &amp;ndash; we are!&lt;/p&gt;
&lt;p&gt;BTW, for more thoughts on the openness aspect, please reference my own personal blog on the topic: &lt;a title="The aggressive optimism of Hadoop" href="http://dennyglee.com/2011/11/13/the-aggressive-optimism-of-hadoop/" target="_blank"&gt;The aggressive optimism of Hadoop&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;But why is Hadoop important to us?&lt;/h3&gt;
&lt;p&gt;But from a CAT perspective, why is Hadoop important?&amp;nbsp; The straightforward answer is that it is important for our customers.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As you may know from our team&amp;rsquo;s blog posts, technical notes, and whitepapers; we work on some of the most complex Tier-1 Enterprise SQL Server implementations.&amp;nbsp; The last few years, we&amp;rsquo;ve seen more and more customers talk about their Big Data problems. Buck Woody (@buckwoody) described these problems the best as &amp;ldquo;Big data is defined as a large set of computationally expensive data that is worked on simultaneously&amp;rdquo; in his post &lt;a title="Big Data and the Cloud - More Hype or a Real Workload?" href="http://blogs.msdn.com/b/buckwoody/archive/2011/10/18/big-data-and-the-cloud-more-hype-or-a-real-workload.aspx" target="_blank"&gt;Big Data and the Cloud - More Hype or a Real Workload?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As Alexander Stojanovic, Founder and General Manager of Hadoop on Azure / Windows Server, noted during the ApacheCon 2011 North America Meetup:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;It&amp;rsquo;s not just your &amp;ldquo;Big Data&amp;rdquo; problems, it&amp;rsquo;s about your BIG &amp;ldquo;Data Problems&amp;rdquo;&lt;/p&gt;
&lt;p&gt;A great example of one of these BIG &amp;ldquo;Data Problems&amp;rdquo; is the Yahoo! &lt;strong&gt;24TB&lt;/strong&gt; Analysis Services cube &amp;ndash; the largest known cube!&amp;nbsp; The cube&amp;rsquo;s data source is &lt;strong&gt;2PB&lt;/strong&gt; from a huge Hadoop cluster.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/5383.Hadoop-to-Cube.png"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/5383.Hadoop-to-Cube.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Following the &lt;a title="4 V's of Big Data" href="http://nosql.mypopescu.com/post/9621746531/a-definition-of-big-data" target="_blank"&gt;4 V&amp;rsquo;s of Big Data&lt;/a&gt;, Yahoo! not only processes a massive &lt;strong&gt;volume&lt;/strong&gt; of campaign web analytics data, but they have to quickly make decisions based on the incoming events (i.e. &lt;strong&gt;velocity&lt;/strong&gt;).&amp;nbsp; Both the &lt;strong&gt;variety&lt;/strong&gt; (many different formats of data) and &lt;strong&gt;variability&lt;/strong&gt; (many different ways of interpreting this data) of the data coming in can be intense hence the importance of using Hadoop.&amp;nbsp;&amp;nbsp; For fast interactive querying of the data, Yahoo! is using Analysis Services to pivot against all of this interesting data.&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;Another great posting on this very topic from Klout: &lt;a title="Big Data, Bigger Brains" href="http://corp.klout.com/blog/2011/11/big-data-bigger-brains/" target="_blank"&gt;Big Data, Bigger Brains&lt;/a&gt;&lt;br /&gt;&amp;hellip;Yes, you read it right.&amp;nbsp; We use a Windows based multi-dimensional (MOLAP) product from Microsoft to load 350 million rows of Hive data per day and achieve an average query response time of under 10 seconds on 35 billion rows of data&lt;/p&gt;
&lt;p&gt;For more information, you can also refer to the &lt;a title="PASS 2010 Summit Day One Keynote" href="http://www.sqlpass.org/summit/na2010/LiveKeynotes/Tuesday.aspx" target="_blank"&gt;PASS 2010 Summit Day One Keynote&lt;/a&gt; and/or the PASS 2011 Session &amp;ldquo;SQLCAT: Tier-1 BI in a world of Big Data&amp;rdquo;.&amp;nbsp;&amp;nbsp; And yes, we are working on a case study as we speak!&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
&lt;p&gt;Denny&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10237129" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/BI/">BI</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Big+Data/">Big Data</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Hadoop/">Hadoop</category></item><item><title>Successfully execute an INSERT, UPDATE and DELETE against a Database Snapshot</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/10/17/updating-a-database-snapshot.aspx</link><pubDate>Tue, 18 Oct 2011 02:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10226724</guid><dc:creator>shauntj-us</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10226724</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/10/17/updating-a-database-snapshot.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;Author&lt;/strong&gt;: Shaun Tinline-Jones&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reviewers&lt;/strong&gt;: Mike Ruthruff, Sanjay Mishra, Alexei Khalyako&lt;/p&gt;
&lt;p&gt;Not too long ago an ISV that developed solutions using SQL Server as the RDBMS, asked me how they could query&amp;nbsp;a database as at a point in time. This was a relatively easy answer, thanks to the&amp;nbsp;Database Snapshot feature. I was however surprised at the next question &amp;ldquo;Can we update the database snapshot?&amp;rdquo;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A reactive response is &amp;ldquo;No. You cannot update a Database Snapshot&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;span style="color: #ff0000;" color="#ff0000"&gt;&lt;span style="color: #ff0000;" color="#ff0000"&gt;&lt;/span&gt;&lt;/span&gt;
&lt;pre style="margin: 0em; padding: 0px 0px 0px 30px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;" id="codeSnippet"&gt;&lt;span style="color: #ff0000;"&gt;Msg 3906, Level 16, State 1, Line 1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #ff0000;"&gt; Failed to update database "Orig_Snapshot" because the database is read-only.&lt;/span&gt;&lt;/pre&gt;
&lt;span style="color: #ff0000;" color="#ff0000"&gt;&lt;span style="color: #ff0000;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color: #008000;"&gt;A creative answer is a tentative &amp;ldquo;&amp;hellip;.well maybe&amp;hellip;depending on what the objective is?&amp;rdquo;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This blog demonstrates that it is possible to run an INSERT, UPDATE or DELETE against a Database Snapshot.&amp;nbsp; This will not update the snapshot, but rather the database that has a "Database Snapshot" associated to it.&lt;/p&gt;
&lt;p&gt;Imagine a scenario where a&amp;nbsp;reconciliation of data at a point in time must be carried out. Database Snapshot provides the ability to present the data as at a point in time, however the common understanding is that any compensating modifications requires a second connection or a USE statement. The USE statement is not permitted in a database module:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div&gt;&lt;span style="color: #ff0000;" color="#ff0000"&gt;&lt;span style="color: #ff0000;" color="#ff0000"&gt;&lt;span style="color: #ff0000;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;pre style="margin: 0em; padding: 0px 0px 0px 30px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;" id="codeSnippet"&gt;&lt;span style="color: #ff0000;"&gt;&lt;/span&gt;&lt;span style="color: #ff0000;"&gt;Msg 154, Level 15, State 1, Procedure testSP, Line 4&lt;br /&gt;a USE database statement is not allowed in a procedure, function or trigger&lt;span style="color: #ff0000;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;span style="color: #ff0000;" color="#ff0000"&gt;&lt;span style="color: #ff0000;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Listing 1 creates the objects needed to prove it is possible to successfully execute DML statements against a Database Snapshot.&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet"&gt;    &lt;span style="color: #0000ff;"&gt;IF&lt;/span&gt; DB_ID(&lt;span style="color: #006080;"&gt;'Orig'&lt;/span&gt;) &lt;span style="color: #0000ff;"&gt;IS&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NULL&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff;"&gt;DROP&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;DATABASE&lt;/span&gt; [Orig]&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;DATABASE&lt;/span&gt; [Orig]&lt;br /&gt;     &lt;span style="color: #0000ff;"&gt;ON&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;PRIMARY&lt;/span&gt; ( NAME = N&lt;span style="color: #006080;"&gt;'Orig'&lt;/span&gt;, FILENAME = N&lt;span style="color: #006080;"&gt;'C:\Program Files\Microsoft SQL Server\MSSQL11.SQL02\MSSQL\DATA\Orig.mdf'&lt;/span&gt;)&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;    USE &lt;span style="color: #0000ff;"&gt;&lt;/span&gt;[Orig]&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;IF&lt;/span&gt; OBJECT_ID(&lt;span style="color: #006080;"&gt;'dbo.TestTable'&lt;/span&gt;, &lt;span style="color: #006080;"&gt;'U'&lt;/span&gt;) &lt;span style="color: #0000ff;"&gt;IS&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NULL&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff;"&gt;DROP&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;TABLE&lt;/span&gt; dbo.TestTable&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;TABLE&lt;/span&gt; dbo.TestTable (Col1 &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt;)&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;IF&lt;/span&gt; OBJECT_ID(&lt;span style="color: #006080;"&gt;'dbo.UpdView'&lt;/span&gt;, &lt;span style="color: #006080;"&gt;'V'&lt;/span&gt;) &lt;span style="color: #0000ff;"&gt;IS&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NULL&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff;"&gt;DROP&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;VIEW&lt;/span&gt; dbo.UpdView&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;VIEW&lt;/span&gt; dbo.UpdView&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; Col1 &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; &lt;span style="background-color: #ffff00;"&gt;Orig.dbo.TestTable&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;INSERT &lt;/span&gt;&lt;span style="color: #0000ff;"&gt;INTO&lt;/span&gt; dbo.TestTable (Col1) &lt;span style="color: #0000ff;"&gt;VALUES&lt;/span&gt; (1)&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;IF&lt;/span&gt; DB_ID(&lt;span style="color: #006080;"&gt;'Orig_Snapshot'&lt;/span&gt;) &lt;span style="color: #0000ff;"&gt;IS&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NULL&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff;"&gt;DROP&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;DATABASE&lt;/span&gt; [Orig_Snapshot]&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;DATABASE&lt;/span&gt; [Orig_Snapshot]&lt;br /&gt;     &lt;span style="color: #0000ff;"&gt;ON&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;PRIMARY&lt;/span&gt; ( NAME = N&lt;span style="color: #006080;"&gt;'Orig'&lt;/span&gt;, FILENAME = N&lt;span style="color: #006080;"&gt;'C:\Program Files\Microsoft SQL Server\MSSQL11.SQL02\MSSQL\DATA\Orig_Snapshot.ss'&lt;/span&gt;)&lt;br /&gt;     &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; SNAPSHOT &lt;span style="color: #0000ff;"&gt;OF&lt;/span&gt; [Orig]&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;USE&lt;/span&gt; [Orig_Snapshot]&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; * &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; dbo.UpdView&lt;br /&gt;    GO&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;After running the above code, you should have a database and an accompanying snapshot of that database. Within the database, you&amp;rsquo;ll have a table with at least 1 row in it and a view that simply returns the contents of that table.&amp;nbsp; This view is a fully qualified name of the original database, this creates 2 scenarios.&amp;nbsp; One is that it becomes possible to view the originating database from within the snapshot, and the second is the ability to run DML statements against the source database from within the database snapshot.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Listing 2&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;" id="codeSnippet"&gt;    &lt;span style="color: #0000ff;"&gt;INSERT &lt;/span&gt;&lt;span style="color: #0000ff;"&gt;INTO&lt;/span&gt; dbo.UpdView &lt;span style="color: #0000ff;"&gt;VALUES&lt;/span&gt; (2), (3);&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;UPDATE&lt;/span&gt; dbo.UpdView &lt;span style="color: #0000ff;"&gt;SET&lt;/span&gt; Col1 = 99 &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; Col1 = 3;&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;DELETE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; dbo.UpdView &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; Col1 = 1;&lt;br /&gt;    &lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; * &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; dbo.UpdView&lt;br /&gt;    GO&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Running the code in listing 2, you should have a result set as shown below:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/5165.UpdateDBSnapshot01.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/5165.UpdateDBSnapshot01.jpg" width="405" height="177" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In conclusion,&lt;/strong&gt; the error message that informs us the database is read-only, while identical to the&amp;nbsp;message returned&amp;nbsp;when writing to a Read-Only database, is only partially accurate in the context of a Database Snapshot. Questions that come to mind are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Is it a bug?&lt;/li&gt;
&lt;li&gt;Would this be considered a good practice?&lt;/li&gt;
&lt;li&gt;What does the code management look like?&lt;/li&gt;
&lt;li&gt;What useful scenarios could leverage this insight?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let me know if you think it&amp;rsquo;s a bug. From my perspective, this makes sense as the database snapshot is actually a read/write database, persisting older values as records change. Additionally, we are not actually updating the Database Snapshot, the changes are still made directly to the main database.&lt;/p&gt;
&lt;p&gt;As far as been a good or recommended practice, my reservations about using this in a design are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Views must be created for each table that can be updated from the database snapshot&lt;/li&gt;
&lt;li&gt;Separate objects/statements must be created for DML operations that already exists for the main table&lt;/li&gt;
&lt;li&gt;It isn&amp;rsquo;t intuitive in terms of troubleshooting code. In fact, if you start down this road you may end up with one of those horrendous applications that have layers upon layers of views ultimately leading to poor performance.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It does however reduce the cost of creating and managing a new connection, especially if the DML statements are a result of a query that originated from the snapshot. Additionally, the logic could reside in the same SP as the query, allowing for conditional logic.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Can you think of other scenarios, pitfalls or benefits of updating the main database via a database snapshot?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10226724" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Development+_2600_amp_3B00_+Programming/">Development &amp;amp; Programming</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+Best+Practices/">SQL Server Best Practices</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/sql/">sql</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Data+Warehouse/">Data Warehouse</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+2008+R2/">SQL Server 2008 R2</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+2008/">SQL Server 2008</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/OLTP/">OLTP</category></item><item><title>SQLPASS 2011 SQLCAT Track</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/10/08/sqlpass-2011-sqlcat-track.aspx</link><pubDate>Sat, 08 Oct 2011 21:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10222330</guid><dc:creator>Denny Lee [MSFT]</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10222330</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/10/08/sqlpass-2011-sqlcat-track.aspx#comments</comments><description>&lt;p&gt;The SQLPASS 2011 summit is upon us again and all of our flocking to our fair city Seattle for our yearly technical-and-karoke fest!&amp;nbsp; If you are up for some technical deep dives, here is the list PASS sessions presented by SQLCAT!&amp;nbsp;&amp;nbsp;&amp;nbsp; And don&amp;rsquo;t forget to check out the &lt;a href="http://www.straightpathsql.com/archives/2011/10/pass-summit-2011-birds-of-a-feather/" target="_blank"&gt;Birds of Feather&lt;/a&gt; event &amp;ndash; the tech talk luncheon.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;table style="width: 753px; border-collapse: collapse;" cellspacing="0" cellpadding="0" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 87pt; mso-width-source: userset; mso-width-alt: 4242;" width="116" /&gt;&lt;col style="width: 266pt; mso-width-source: userset; mso-width-alt: 12946;" width="354" /&gt;&lt;col style="width: 212pt; mso-width-source: userset; mso-width-alt: 10349;" width="283" /&gt;&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr style="height: 12.75pt;" height="17"&gt;
&lt;td class="xl66" style="background: #4f81bd; border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; mso-pattern: #4f81bd none; text-underline-style: none; text-line-through: none;" height="17" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="color: #ffffff; font-size: 10pt;" color="#ffffff"&gt;&lt;strong&gt;Session Code&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl66" style="background: #4f81bd; border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #4f81bd none; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="color: #ffffff; font-size: 10pt;" color="#ffffff"&gt;&lt;strong&gt;Session Name&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl66" style="background: #4f81bd; border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #4f81bd none; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="color: #ffffff; font-size: 10pt;" color="#ffffff"&gt;&lt;strong&gt;Speakers&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 25.5pt;" height="34"&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" height="34" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;DBA-414-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Are You Smarter Than An MCM?&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Cindy Gross, Jimmy May, Lara Rubbelke, Pam Lahoud, Robert Davis,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 12.75pt;" height="17"&gt;
&lt;td class="xl65" style="border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; text-underline-style: none; text-line-through: none;" height="17" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;DBA-323-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Improving Your PowerShell Productivity&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Dan Jones,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 51pt;" height="68"&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" height="68" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;AD-313-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQL Server Engine Team - Unplugged&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Alex Verbitski, Ashit Gosalia, Cihan Biyikoglu, Cipri Clinciu, Dana Kaufman, Eric Kang, Gus Apostol, Justin Erickson, Rohan Kumar, Sunil Agarwal, Susan Price,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 38.25pt;" height="51"&gt;
&lt;td class="xl65" style="border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; text-underline-style: none; text-line-through: none;" height="51" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;AD-405-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: Building Highly Scalable Cloud Analytics Solutions with SQL Azure and StreamInsight (Project Austin)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Mark Simms,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 38.25pt;" height="51"&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" height="51" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;BIA-409-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: Configuring and Securing Complex BI Applications in a SharePoint 2010 Environment with SQL Server Code Name "Denali"&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Carl Rabeler, Chuck Heinzelman,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 12.75pt;" height="17"&gt;
&lt;td class="xl65" style="border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; text-underline-style: none; text-line-through: none;" height="17" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;DBA-413-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: Enterprise SQL I/O Optimization Best Practices&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Jimmy May, Mike Ruthruff, Thomas Kejser,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 25.5pt;" height="34"&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" height="34" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;DBA-332-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: HA/DR Customer Panel -- SQL Server Code Name "Denali" AlwaysOn Deployment Consideration&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Ayad Shammout, David Smith, Michael Steineke, Sanjay Mishra, Thomas Grohser,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 25.5pt;" height="34"&gt;
&lt;td class="xl65" style="border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; text-underline-style: none; text-line-through: none;" height="34" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;DBA-324-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: Optimize SQL Server for Private Cloud part2: Best Practices and Lessons Learned&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Alan Cranfield, Lindsey Allen, Xin Jin,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 25.5pt;" height="34"&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" height="34" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;DBA-328-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: SQL Server Consolidation at Travelers &amp;ndash; How we did it and Lessons Learned&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Bob Crowley, Prem Mehra,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 38.25pt;" height="51"&gt;
&lt;td class="xl65" style="border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; text-underline-style: none; text-line-through: none;" height="51" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;DBA-325-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: SQL Server HA and DR Design Patterns, Architectures and Best Practices using SQL Server Code Name "Denali" AlwaysOn&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Sanjay Mishra,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 38.25pt;" height="51"&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" height="51" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;AD-406-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: SQL Server Tier-1 Mission Critical Application at Progressive &amp;ndash; Architecture Deployed and Lessons Learned&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Brian Durkin, David Wilson, Prem Mehra,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 12.75pt;" height="17"&gt;
&lt;td class="xl65" style="border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; text-underline-style: none; text-line-through: none;" height="17" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;BIA-408-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: Tier-1 BI in world of Big Data&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Denny Lee, Thomas Kejser,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 25.5pt;" height="34"&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" height="34" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;AZ-302-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: What are the Largest Azure Projects in the World and how do they Scale&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="background: #dce6f1; border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; mso-pattern: #dce6f1 none; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Kevin Cox, Michael Thomassy,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="height: 25.5pt;" height="34"&gt;
&lt;td class="xl65" style="border-style: solid none solid solid; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-left-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; border-left-width: 0.5pt; text-underline-style: none; text-line-through: none;" height="34" width="116"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;DBA-326-M&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="354"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;SQLCAT: What are the Largest SQL Server Projects in the World and how do they Scale&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td class="xl65" style="border-style: solid solid solid none; padding-top: 1px; padding-right: 1px; padding-left: 1px; vertical-align: top; border-top-color: #95b3d7; border-right-color: #95b3d7; border-bottom-color: #95b3d7; border-top-width: 0.5pt; border-right-width: 0.5pt; border-bottom-width: 0.5pt; text-underline-style: none; text-line-through: none;" width="282"&gt;&lt;span style="font-family: Arial;" face="Arial"&gt;&lt;span style="font-size: 10pt;"&gt;Kevin Cox, Nicholas Dritsas,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&lt;span style="font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10222330" width="1" height="1"&gt;</description></item><item><title>Maximizing SQL Server Throughput with RSS Tuning</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/09/27/maximizing-sql-server-throughput-with-rss-tuning.aspx</link><pubDate>Tue, 27 Sep 2011 02:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10216978</guid><dc:creator>Kun Cheng</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10216978</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/09/27/maximizing-sql-server-throughput-with-rss-tuning.aspx#comments</comments><description>&lt;p&gt;&lt;b&gt;Author&lt;/b&gt;: Kun Cheng&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Reviewers&lt;/b&gt;: Thomas Kejser, Curt Peterson, James Podgorski, Christian Martinez, Mike Ruthruff&lt;/p&gt;
&lt;p&gt;Receive-Side Scaling (RSS) was introduced in Windows 2003 to improve Windows scalability to handle heavy network traffic, which is typically the case for SQL Server OLTP workload.&amp;nbsp;For more details about RSS improvement on Windows 2008, please check out the whitepaper - &lt;a href="http://msdn.microsoft.com/en-us/windows/hardware/gg463253.aspx"&gt;http://msdn.microsoft.com/en-us/windows/hardware/gg463253.aspx&lt;/a&gt;&amp;nbsp;and the blog - &lt;a href="http://sqlcat.com/sqlcat/b/msdnmirror/archive/2008/09/18/scaling-heavy-network-traffic-with-windows.aspx"&gt;http://sqlcat.com/sqlcat/b/msdnmirror/archive/2008/09/18/scaling-heavy-network-traffic-with-windows.aspx&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I was recently working with a partner to test a high scale SQL load against a DL980 server with 8 sockets, 80 physical cores running Windows 2008 R2 sp1. The SQL box had 4 NIC (1Gbps) cards to handle network traffic between SQL and application servers. To our surprise, we observed during the test only 2 out of 80 CPU cores maxed out with almost all of it come from privileged/DPC % time. We knew Windows 2008 R2 by default reserves up to 4 CPU cores as designated RSS handlers (see above white paper). Why would it only use 2 in our environment? Note DPC time could be driven by device drivers such as network, storage drivers. You can use Windows XPerf tool (&lt;a href="http://msdn.microsoft.com/en-us/performance/cc752957.aspx"&gt;http://msdn.microsoft.com/en-us/performance/cc752957.aspx&lt;/a&gt;) to trace and identify the main consumer(s) of DPC time at driver level. For example, in our case, most of it was consumed by NDIS.sys, which falls under network driver.&lt;/p&gt;
&lt;p&gt;Suspecting that the above behavior might be just Windows bug, I explicitly set the &lt;b&gt;MaxNumRssCpus &lt;/b&gt;registry value as 8 in HLKM\System\CurrentControlSet\Services\Ndis\Parameters (see above white paper) hoping it would give us extra CPUs to handle network packet interrupts. Well, that didn&amp;rsquo;t make a difference. I reached out to our friends at Windows networking group seeking answer to the puzzle. While waiting for a response, I asked my partner to try to connect application servers to all 4 NIC cards (we divided evenly the instances of the applications to communicate to each separate IP address). Bingo, we see now 8 cores with expected high DPC % CPU time.&lt;/p&gt;
&lt;p&gt;So based on our try/error testing, it appeared that each NIC/IP can only use 2 CPUs for RSS. What were we missing? Windows networking team responded later and gave us suggestion to check &amp;ldquo;RSS rings&amp;rdquo; setting for each NIC. Note the term varies between different NIC vendors. Some refer to &amp;ldquo;RSS Queues&amp;rdquo;, which is the same thing. Essentially, each CPU core that a NIC uses will need an associated ring when RSS is enabled. In other words, the number of RSS CPUs on a system would be capped by both &lt;b&gt;MaxNumRssCpus &lt;/b&gt;registry key&lt;b&gt; &lt;/b&gt;and &amp;ldquo;RSS rings&amp;rdquo; NIC property setting whichever is the lowest. Once we went to check the NIC setting (properties &amp;ndash; advanced tab), it&amp;rsquo;s indeed set as 2, which explained why we saw only 2 CPU cores being utilized for RSS when single NIC card was used. Remember the setting of &amp;ldquo;RSS rings&amp;rdquo; varies between hardware. In our case, each NIC supported up to 4 &amp;ldquo;RSS rings&amp;rdquo; so we can&amp;rsquo;t go above 4 RSS CPUs for each card (see figure 1 below). Also keep in mind RSS CPUs can only be assigned to the first K group on Windows 2008 R2 or prior. Check out this blog about DL980 configuration including K group - &lt;a href="http://blogs.msdn.com/b/saponsqlserver/archive/2011/06/10/customer-proof-of-concept-on-new-hp-dl980.aspx"&gt;http://blogs.msdn.com/b/saponsqlserver/archive/2011/06/10/customer-proof-of-concept-on-new-hp-dl980.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/3618.nic.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/3618.nic.jpg" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/8623.nic.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Figure 1&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the end, we continued to use our &amp;ldquo;workaround&amp;rdquo; of scaling network load out to 4 NIC cards, which gave us enough network bandwidth as well as RSS CPUs to handle the heavy network traffic. You can certainly use more powerful 10Gbps NIC, but remember to configure &amp;ldquo;RSS rings&amp;rdquo; to a proper value.&lt;/p&gt;
&lt;p&gt;In summary, follow these RSS tuning rules to configure a SQL Server box to handle high network traffic:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;At Windows level, configure number of max RSS CPUs (and optional &amp;ldquo;starting RSS CPU&amp;rdquo;) by following &lt;a href="http://msdn.microsoft.com/en-us/windows/hardware/gg463253.aspx"&gt;http://msdn.microsoft.com/en-us/windows/hardware/gg463253.aspx&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;At individual NIC level, configure &amp;ldquo;RSS Rings&amp;rdquo; (&amp;ldquo;RSS Queues&amp;rdquo;) to proper value so the sum would match the value of MaxNumRssCpu of Windows setting. Note the max configurable value of the NIC setting varies between different vendors. You might have to upgrade or install additional cards to support a heavy network workload.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10216978" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/sql/">sql</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/NIC/">NIC</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/RSS/">RSS</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/network/">network</category></item><item><title>“QUOTED_IDENTIFIER” causes Unexpected Query Plan for Persisted Computed Column query</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/08/31/unexpected-query-plan-for-computed-column.aspx</link><pubDate>Wed, 31 Aug 2011 16:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10203749</guid><dc:creator>shauntj-us</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10203749</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/08/31/unexpected-query-plan-for-computed-column.aspx#comments</comments><description>&lt;p&gt;&lt;b&gt;Author&lt;/b&gt;: Shaun Tinline-Jones&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Technical Reviewers&lt;/b&gt;: Thomas Kejser, Steve Howard, Jaime Alva Bravo, Kun Cheng, Jimmy May&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Validation for this post was performed in the SQL CAT Customer Lab on an &lt;a href="http://h10010.www1.hp.com/wwpc/us/en/sm/WF05a/15351-15351-3328412-241644-3328422-4142916.html"&gt;HP Proliant DL580 G7&lt;/a&gt;, Intel Xeon Nehalem E7-4870 2.40 GHz 4 socket, 10 physical cores, 20 logical cores for a total of 40 physical cores, 80 logical cores; 1TB RAM. SQL Server 2008 R2 was installed on a &lt;a href="http://www.fusionio.com/products/iodrive-duo"&gt;Fusion-io ioDrive Duo&lt;/a&gt; 1.28TB MCL using driver version 2.3.1&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We recently engaged a Tier 1 Global ISV in our labs, where the objective was to achieve the highest Business Transactions for their application.&lt;/p&gt;
&lt;p&gt;During the testing and optimizing we encountered an interesting behavior where we kept incurring a clustered index scan; irrespective of applying known techniques to generate an index seek. In this blog, I will share the reproducible steps that reveal the following observation:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;If the table has a persisted computed column*, the query optimizer will choose a clustered index scan over a clustered index seek.&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote style="padding-left: 30px;"&gt;
&lt;p style="padding-left: 30px;" align="left"&gt;&lt;span style="font-size: xx-small;"&gt;*This applies to the case, which is most common, where the compute expression doesn&amp;rsquo;t produce a constant.&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here is the code to create the table &amp;amp; SPs that we&amp;rsquo;ll refer to for describing this behavior:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;IF&lt;/span&gt; OBJECT_ID(&lt;span style="color: #006080;"&gt;'dbo.testComputedCol'&lt;/span&gt;) &lt;span style="color: #0000ff;"&gt;IS&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NULL&lt;/span&gt;&lt;br /&gt; &lt;span style="color: #0000ff;"&gt;DROP&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;TABLE&lt;/span&gt; dbo.TestComputedCol&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;IF&lt;/span&gt; OBJECT_ID(&lt;span style="color: #006080;"&gt;'dbo.GetResults01'&lt;/span&gt;) &lt;span style="color: #0000ff;"&gt;IS&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NULL&lt;/span&gt;&lt;br /&gt; &lt;span style="color: #0000ff;"&gt;DROP&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;PROC&lt;/span&gt; dbo.GetResults01&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;IF&lt;/span&gt; OBJECT_ID(&lt;span style="color: #006080;"&gt;'dbo.GetResults02'&lt;/span&gt;) &lt;span style="color: #0000ff;"&gt;IS&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NULL&lt;/span&gt;&lt;br /&gt; &lt;span style="color: #0000ff;"&gt;DROP&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;PROC&lt;/span&gt; dbo.GetResults02&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;TABLE&lt;/span&gt; dbo.TestComputedCol (Col1 &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;PRIMARY&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;KEY&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;CLUSTERED&lt;/span&gt;, Col2 &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;NONCLUSTERED&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;INDEX&lt;/span&gt; NDX_TestComputedCol_Col2 &lt;span style="color: #0000ff;"&gt;ON&lt;/span&gt; dbo.TestComputedCol (Col2)&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;SET&lt;/span&gt; NOCOUNT &lt;span style="color: #0000ff;"&gt;ON&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;DECLARE&lt;/span&gt; @&lt;span style="color: #0000ff;"&gt;Count&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;int&lt;/span&gt; = 1;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;WHILE&lt;/span&gt; @&lt;span style="color: #0000ff;"&gt;Count&lt;/span&gt; &amp;lt; 1000&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;BEGIN&lt;/span&gt;&lt;br /&gt; INSERT &lt;span style="color: #0000ff;"&gt;INTO&lt;/span&gt; dbo.TestComputedCol (Col1, Col2) &lt;span style="color: #0000ff;"&gt;VALUES&lt;/span&gt; (@&lt;span style="color: #0000ff;"&gt;Count&lt;/span&gt;, @&lt;span style="color: #0000ff;"&gt;Count&lt;/span&gt;*10)&lt;br /&gt;&lt;br /&gt; &lt;span style="color: #0000ff;"&gt;SET&lt;/span&gt; @&lt;span style="color: #0000ff;"&gt;Count&lt;/span&gt; += 1&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;END&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span style="color: #0000ff;"&gt;OFF&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;PROC&lt;/span&gt; dbo.GetResults01&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; * &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; dbo.TestComputedCol &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; Col1 = 10&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span style="color: #0000ff;"&gt;ON&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;PROC&lt;/span&gt; dbo.GetResults02&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; * &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; dbo.TestComputedCol &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; Col1 = 10&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;p&gt;To baseline the scenario we are describing, we run both SPs and confirm that we experience the index seek operation.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;EXEC&lt;/span&gt; dbo.GetResults01&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/6560.Image1.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/6560.Image1.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;EXEC&lt;/span&gt; dbo.GetResults02&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/0246.Image2.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/0246.Image2.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In our scenario we recognized the need to partition the data to avoid the &lt;a href="http://sqlcat.com/technicalnotes/archive/2009/09/22/resolving-pagelatch-contention-on-highly-concurrent-insert-workloads-part-1.aspx"&gt;last page insert contention&lt;/a&gt; issue and therefore implemented a computed column, similar to the below statement. While creating the column it is documented that the Quoted Identifier must be ON in order to &lt;a href="http://msdn.microsoft.com/en-us/library/ms189292.aspx"&gt;create the computed column&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;b&gt;Side Note&lt;/b&gt;: For resolving the Last Page Insert Contention challenge, we are left with two choices, troubleshoot the reason for the differing behavior or change the insert behavior to include setting a value for the partition bucket. We chose to troubleshoot the issue. This blog is not striving to optimize the partition hash; however it&amp;rsquo;s important to recognize that resolving the Last Page Insert Contention through a computed column is not optimal.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;In its literal sense QUOTED_IDENTIFIER is required to parse quoted strings as identifiers. A recommended practice is to rather use square brackets &amp;ldquo;[&amp;rdquo; as an identifier. Therefore it&amp;rsquo;s not intuitive that the QUOTED_IDENTIFIER setting influences queries against computed columns.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;NOTE&lt;/b&gt;: When a &lt;a href="http://msdn.microsoft.com/en-us/library/ms174979.aspx"&gt;table is created&lt;/a&gt;, the QUOTED_IDENTIFIER option is always stored as ON in the metadata for the table, irrespective of the current setting. However when creating a computed column, the setting must be set to ON.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;SET&lt;/span&gt; QUOTED_IDENTIFIER &lt;span style="color: #0000ff;"&gt;ON&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;ALTER&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;TABLE&lt;/span&gt; dbo.TestComputedCol&lt;br /&gt; &lt;span style="color: #0000ff;"&gt;ADD&lt;/span&gt; ComputedCol &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;CAST&lt;/span&gt;(Col1%10 &lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt; tinyint) PERSISTED &lt;span style="color: #0000ff;"&gt;NOT&lt;/span&gt; NULL&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;In our solution, prior to adding the computed column, a frequently called SP generated a query plan very similar to what you see below:&lt;/div&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;EXEC&lt;/span&gt; dbo.GetResults01&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/8080.Image3.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/8080.Image3.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;p&gt;However after the computed column was added, executing the same SP generated the following query plan.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/4721.Image4.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-50-01/4721.Image4.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;At first this may seem unexpected, and frustrating. However, some may infer that this is expected behavior, as described in article &lt;a href="http://msdn.microsoft.com/en-us/library/ms189292.aspx"&gt;Creating Indexes on Computed Columns&lt;/a&gt;. Take note that this is an inference or a source of data points, as we did not add an index to the computed column. Does this happen if the SELECT and WHERE columns are not referencing the computed column? We modified the SP to follow the recommended practice of explicitly specifying only the required columns,&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; Col1, Col2 &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; dbo.TestComputedCol &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; Col1 = 10&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;p&gt;Unfortunately, &lt;b&gt;&lt;span style="color: #ff0000;" color="#ff0000"&gt;you cannot shake the scan this way!&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The only way to resolve the issue is to ensure the QUOTED_IDENTIFIER to ON during the execution of the batch. The challenge is finding the right place to ensure the effective setting at runtime.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Side Note&lt;/b&gt;: In this scenario a computed column will be the partitioning column, which requires a PERSISTED property. The above issue doesn&amp;rsquo;t occur if the computed column is not persisted.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The default value for &lt;a href="http://msdn.microsoft.com/en-us/library/ms174393.aspx"&gt;QUOTED_IDENTIFIERS&lt;/a&gt; is ON; however it can be changed at a variety of points. Therefore you may not encounter the above issue, yet when it does occur it may not be intuitive to check the QUOTED_IDENTIFIER setting or even at which point along the path it has been changed.&lt;/p&gt;
&lt;p&gt;The setting can be applied:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;As a connection attribute&lt;/li&gt;
&lt;li&gt;As a database option&lt;/li&gt;
&lt;li&gt;As an object attribute&lt;/li&gt;
&lt;li&gt;As a runtime SET option&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In our case, we unexpectedly started incurring the index scan. We identified these index scans when the table partitioning strategy didn&amp;rsquo;t produce the benefits we sought. Troubleshooting revealed that when we ran the code (from the SP) as an isolated batch in a Query Analyzer window, we got the seek behavior. If we ran the SP in the same Query Analyzer window but in a separate batch, we got the scan behavior. When we ran the code using the osql utility, we got scan behavior for both batch executions. If we changed the computed column to a constant value, then we got the seek behavior.&lt;/p&gt;
&lt;p&gt;The clue to finding a resolution is in the differences between the osql.exe and SSMS outcomes. These utilities have different defaults for connection attributes. &lt;b&gt;&lt;span style="color: #0000ff;" color="#0000ff"&gt;The resolution lies in creating the stored procedure with QUOTED_IDENTIFIERS set to ON&lt;/span&gt;&lt;/b&gt;. An interesting observation is that it&amp;rsquo;s redundant to set the quoted identifier setting within the stored procedure; the setting at creation time will take precedence.&lt;/p&gt;
&lt;p&gt;Let me share with you how ALM (Application Lifecycle Management) practices of the ISV caused this issue to slither its way into the solution.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;NOTE&lt;/b&gt;: Keep in mind that there are many variations of what I&amp;rsquo;m about to describe&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A developer creates a module, such as an SP, using a tool such as SSMS, VSTS, osql, sqlcmd, and others but most often SSMS. When the developer is done unit testing, a script file is checked into the source control system, below is an example of such a file.&lt;/p&gt;
&lt;div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;PROC&lt;/span&gt; dbo.GetResults01&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;AS&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; * &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; dbo.TestComputedCol &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; Col1 = 10&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;GO&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;The Build Process then generates a deployment script. There are a variety of ways that deployment scripts can be generated and run against the target SQL Server and database instance. The point in the above scenario is that &lt;b&gt;the QUOTED_IDENTIFIER setting for this object is dependent on the current connection attribute of the deployment script generator.&lt;/b&gt;&lt;/div&gt;
&lt;p&gt;&lt;i&gt;If the deployment script does not specify QUOTED_IDENTIFIER setting for the objects, then the setting will be dependent on the connection settings when the script is run&lt;/i&gt;. The Build Process for the ISV leverages the osql.exe utility, which has a default setting of OFF. It&amp;rsquo;s not uncommon for build processes to use the SQLCMD.exe, which would cause the same behavior.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;NOTE&lt;/b&gt;: If the connection does not set this attribute, then the database setting will take precedence. By default, ODBC and OLEDB set the option to ON. For DB-Library the default is OFF. Therefore it is very unlikely that the database default is ever enforced.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="119"&gt;
&lt;p align="center"&gt;&lt;b&gt;Tool&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="222"&gt;
&lt;p&gt;&lt;b&gt;Default Quoted Identifier Setting&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="119"&gt;
&lt;p&gt;&lt;b&gt;osql.exe&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="222"&gt;
&lt;p&gt;OFF&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="119"&gt;
&lt;p&gt;&lt;b&gt;sqlcmd.exe&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="222"&gt;
&lt;p&gt;OFF&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="119"&gt;
&lt;p&gt;&lt;b&gt;SQLCMD Scripts&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="222"&gt;
&lt;p&gt;ON&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="119"&gt;
&lt;p&gt;&lt;b&gt;SSMS&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="222"&gt;
&lt;p&gt;ON&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Below are T-SQL queries to identify current QUOTED_IDENTIFIER settings:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; DATABASEPROPERTYEX(DB_NAME(), &lt;span style="color: #006080;"&gt;'IsQuotedIdentifiersEnabled'&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; * &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; sys.databases &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; is_quoted_identifier_on = 0&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; quoted_identifier, * &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; sys.dm_exec_sessions &lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; session_id = &lt;span style="color: #cc6633;"&gt;@@SPID&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;p&gt;They each have cases where they are useful, though I particularly like:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="color: #0000ff;"&gt;SELECT&lt;/span&gt; * &lt;span style="color: #0000ff;"&gt;FROM&lt;/span&gt; sys.objects &lt;br /&gt;&lt;span style="color: #0000ff;"&gt;WHERE&lt;/span&gt; OBJECTPROPERTYEX(object_id, &lt;span style="color: #006080;"&gt;'IsQuotedIdentOn'&lt;/span&gt;) = 0 &lt;span style="color: #0000ff;"&gt;AND&lt;/span&gt; TYPE &amp;lt;&amp;gt; &lt;span style="color: #006080;"&gt;'S'&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;p&gt;This last query reveals those objects that deviate from the recommended standard of having QUOTED_IDENTIFIER set to ON.&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #0000ff; font-family: Cambria; font-size: medium;" color="#0000ff" face="Cambria" size="4"&gt;&lt;em&gt;In conclusion&lt;/em&gt;&lt;/span&gt;&amp;hellip;there are connection settings that can influence the behaviors of the queries and output. Therefore it&amp;rsquo;s important to standardize on a setting, the more aligned it is with the industry defaults the easier it is to adhere to the standard.&lt;/p&gt;
&lt;p&gt;Historically, prior to computed columns, quoted identifiers were used merely to distinguish strings from literals. It is recommended that literals are identified by square brackets, and strings are defined by single quotes. It is further recommended to keep quoted identifier setting to ON in all cases, even if it means explicitly adding this to script files before objects are created.&lt;/p&gt;
&lt;p&gt;For our scenario, we conclude that it&amp;rsquo;s not intuitive that the reason behind the index scan is related to a quoted identifiers setting, therefore we standardize that the setting be ON and run the above queries to validate all appropriate objects have this setting to ON as part of validating a build deployment.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10203749" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Development+_2600_amp_3B00_+Programming/">Development &amp;amp; Programming</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Query+performance/">Query performance</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+Best+Practices/">SQL Server Best Practices</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Data+Warehouse/">Data Warehouse</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Partitioning/">Partitioning</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Connectivity/">Connectivity</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/OLTP/">OLTP</category></item><item><title>SSAS Maestros August 2011 Update</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/08/23/ssas-maestros-august-2011-update.aspx</link><pubDate>Tue, 23 Aug 2011 18:02:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10199111</guid><dc:creator>Denny Lee [MSFT]</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10199111</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/08/23/ssas-maestros-august-2011-update.aspx#comments</comments><description>&lt;p&gt;As noted in our blog post Announcing &lt;a title="http://sqlcat.com/sqlcat/b/msdnmirror/archive/2011/05/11/announcing-ssas-maestros-v1-2.aspx" href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/SSAS Maestros v1.2" target="_blank"&gt;SSAS Maestros v1.2&lt;/a&gt;, we had a great Analysis Services Level 500 deep dive sessions in Redmond and Madrid back in June/July 2011.&amp;nbsp; Saying this, we do have some quick updates on the SSAS Maestros current status:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;Annoucing the first set of SSAS Maestros&lt;/strong&gt;&lt;/span&gt;:&lt;/p&gt;
&lt;p&gt;We have completed the evaluations of the v1.0 Maestros (Feb/Mar 2011) attendees and we will be notifying all of those attendees within the next few weeks - best of luck!&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;SSAS Maestros v1.2 evaluations&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;We are currently working on the logistics behind the SSAS Maestros evaluations taught by SQLCAT&amp;nbsp;&amp;nbsp;and our partners -&amp;nbsp;Chris Webb [&lt;a href="http://cwebbbi.wordpress.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt;], Marco Russo [&lt;a href="http://sqlblog.com/blogs/marco_russo/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/marcorus"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;], Stacia Misner [&lt;a href="http://blog.datainspirations.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/StaciaMisner"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;], and Adam Jorgensen [&lt;a href="http://www.adamjorgensen.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/adam_jorgensen"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;].&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;&lt;strong&gt;SSAS Maestros gets a great boost!&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As well, we're glad to have the intrepid Robert Davis (@sqlsoldier) helping us with the logistics surrounding SSAS Maestros - more to come shortly!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks from your&amp;nbsp;friendly SQLCAT SSAS Maestros&lt;/p&gt;
&lt;p&gt;- John Sirmon [&lt;a href="http://ssascat.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/elcid98"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;], Thomas Kejser [&lt;a href="http://kejserbi.wordpress.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a title="http://twitter.com/thomaskejser" href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/twitter"&gt;twitter&lt;/a&gt;], and Denny Lee [&lt;a href="http://dennyglee.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/dennylee"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10199111" width="1" height="1"&gt;</description></item><item><title>Unintended Consequences of Scalar-Valued User Defined Functions</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/06/24/unintended-consequences-of-scalar-valued-user-defined-functions.aspx</link><pubDate>Fri, 24 Jun 2011 21:05:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10178858</guid><dc:creator>ChuckHeinzelman</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10178858</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/06/24/unintended-consequences-of-scalar-valued-user-defined-functions.aspx#comments</comments><description>&lt;p&gt;&lt;b&gt;Author:&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Chuck Heinzelman&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Reviewers:&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Kevin Cox, Dan Jones, Lara Rubbelke&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;During a customer engagement, we noticed a query that was taking a long time to execute.&amp;nbsp; We saw that the query had a scalar-valued User Defined Function (UDF) encapsulating functionality in the SELECT clause.&amp;nbsp; To understand why this could be a problem, you need to understand how SQL Server deals with functions in the SELECT clause.&amp;nbsp; Let&amp;rsquo;s take a quick dive into how this works in SQL Server.&lt;/p&gt;
&lt;p&gt;Assume that I have a table with the following structure:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;CREATE TABLE dbo.Numbers&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;(&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; Number integer NOT NULL PRIMARY KEY CLUSTERED&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Now assume that this table has 100,000 rows in it &amp;ndash; numbered 1 to 100,000.&amp;nbsp; As an aside, I like to have a table like this with about 1,000,000 rows in it for occasions where I need to duplicate data.&amp;nbsp; You never know when you will need a table of numbers!&lt;/p&gt;
&lt;p&gt;If I execute the following SQL Statement, what will I get?&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;SELECT Number, GetDate() AS CurDate&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;FROM dbo.Numbers&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;WHERE Number &amp;lt;= 1000;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If you answered 1000 rows with the numbers 1 - 1000 and the exact same value for the CurDate column in every row, you would be correct.&amp;nbsp; This is because SQL Server only executes the GetDate() function once for the entire statement.&lt;/p&gt;
&lt;p&gt;Now assume that I create the following function:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;CREATE FUNCTION dbo.GetDateFunction()&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;RETURNS DateTime&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;AS&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;BEGIN&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; RETURN GetDate();&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;END&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If I execute the following SQL Statement, what will I get?&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;SELECT Number, dbo.GetDateFunction() AS CurDate&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;FROM dbo.Numbers&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;WHERE Number &amp;lt;= 1000;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If you said that my results would be the same as in the last example, you would be incorrect.&amp;nbsp; Since we encapsulated the GetDate() function in our own user-defined function, SQL Server had to execute it for every row returned, not just once for the entire query.&amp;nbsp; This knowledge is fundamental to understanding the performance of the queries that you write as well as ensuring that you get the results that you expect.&lt;/p&gt;
&lt;p&gt;Unfortunately, our problem was not this simple.&amp;nbsp; We were dealing with encryption and decryption functions.&amp;nbsp; Take the following query as an example:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;SELECT RowID, DecryptByKey(EncryptedColumn)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;FROM dbo.TableWithManyRows;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In this case, even though the DecryptByKey function is a built-in function, it will be called once per row (each individual value needs to be decrypted).&amp;nbsp; Given that, what would be the harm of having this function embedded in a user defined function like this:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;CREATE FUNCTION dbo.DecryptByKeyFunction(@Data varchar(255))&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;RETURNS varchar(255)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;AS&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;BEGIN&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; RETURN DecryptByKey(@Data);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;END&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And using it like this:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;SELECT RowID, dbo.DecryptByKeyFunction(EncryptedColumn)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;FROM dbo.TableWithManyRows;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Implementing it this way would allow you to easily swap out the encryption functionality for your entire system by changing a single function rather than changing every query that uses this logic.&lt;/p&gt;
&lt;p&gt;The problem is that while the inline DecryptByKey function is called for each row in the query, the key is only opened once for the entire statement.&amp;nbsp; If you put the DecryptByKey function in your own user defined function, the key will need to be opened for each function call rather than once for the entire query.&amp;nbsp; In our scenario, this caused a huge performance issue.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;/b&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Knowing the behavior of built-in and User Defined Functions is extremely important to understanding the performance and output of the queries that you write.&amp;nbsp; I am not trying to tell you to never use UDFs &amp;ndash; just be sure to test your solutions thoroughly and understand all of the &amp;ldquo;unintended consequences&amp;rdquo; of encapsulating logic inside a UDF before rolling your solution out &amp;ndash; even to your developers.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10178858" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/UDF/">UDF</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/User+Defined+Functions/">User Defined Functions</category></item><item><title>Why can't I attach a database to SQL Server 2008 R2?</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/06/20/why-can-t-i-attach-a-database-to-sql-server-2008-r2.aspx</link><pubDate>Mon, 20 Jun 2011 14:41:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10176978</guid><dc:creator>Kevin Cox SQL Server</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10176978</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/06/20/why-can-t-i-attach-a-database-to-sql-server-2008-r2.aspx#comments</comments><description>&lt;p&gt;Recently, a problem was presented to me by a DBA using SQL Server 2008 R2.&amp;nbsp; He could not attach a database whose files&lt;br /&gt;had been copied from another server. This blog talks about the situation and the solution.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here are the steps he went through to arrive at his situation.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;DBA #1 logs into a remote server #1 using SSMS from his desktop and detaches a database.&lt;/li&gt;
&lt;li&gt;DBA #2 copies the files to SQL Server #2 and using SSMS on his desktop attempts to attach that database.&lt;/li&gt;
&lt;li&gt;DBA #2 gets an error saying he does not have permissions to attach the database. (Did not capture the exact error message).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Other pertinent information:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Both DBAs are in the sysadmin role on both SQL Server machines.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Both DBAs are in the local admin group on both SQL Server machines.&lt;/li&gt;
&lt;li&gt;Neither person is a domain admin.&lt;/li&gt;
&lt;li&gt;Did not run SSMS with the &amp;ldquo;run as administrator&amp;rdquo; option.&lt;/li&gt;
&lt;li&gt;UAC is turned on for the Windows 7 client running SSMS on both of the DBA machines.&lt;/li&gt;
&lt;li&gt;Both SQL Servers are running Windows 2008 R2 with latest service pack and SQL Server 2008 R2 with latest service pack.&lt;/li&gt;
&lt;li&gt;The SQL Servers are in different domains (big clue #1).&lt;/li&gt;
&lt;li&gt;The domains are not trusted. (big clue #2).&lt;/li&gt;
&lt;li&gt;There are no certificates involved.&lt;/li&gt;
&lt;li&gt;SQL Server service accounts are Local accounts but are not in the local administrators group.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;My first thought is that because both DBAs are local admins and sysadmins the attach database command should succeed.&amp;nbsp; A quick&lt;br /&gt;check of Books on Line (BOL) brings this explanation of why it did not work: &lt;a href="http://msdn.microsoft.com/en-us/library/ms189128.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms189128.aspx&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The reason this did not work initially is because two different people did the detach and attach operations as explained in the BOL link. So the files were owned by DBA 1. However, DBA 2 was a local administrator so he had access to the directory&lt;br /&gt;where the files were stored, so he could copy the files.&amp;nbsp; But the attach failed on server 2 because DBA 2 was not the file owner. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;To get this to work, we went into the copied file properties for the .mdf and .ldf files and changed them to be owned by the local SQL Server service account.&amp;nbsp; Then the attach worked.&amp;nbsp; It would also have worked to change the file owner to DBA 2, the one issuing the attach command.&lt;/p&gt;
&lt;p&gt;To test the scenario where the same person does the entire process, we created a sample database on server 1 and used the same person to detach, copy and attach the databases.&amp;nbsp; The same servers involved in the original problem were used.&amp;nbsp; This time the attach operation worked.&lt;/p&gt;
&lt;p&gt;We noticed something interesting during this test.&amp;nbsp; After creating the sample database, the mdf and ldf files (while still attached) are owned by the SQL Server service account.&amp;nbsp; Use Windows Explorer and properties of the file to see the owner.&amp;nbsp;&amp;nbsp; Then we detach the files, the owner becomes the person who did the detach command.&amp;nbsp; After copying the files to server 2, the ownership remains the same; i.e. the person who issued the detach command.&amp;nbsp; After the attach command is issued on server 2, the file owner becomes the new SQL Server service account.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Impersonation is important&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;This test worked because the same person did the entire process.&amp;nbsp; Whether you use SQL authentication or Windows authentication to log into the database via SSMS, the process works as long as the same person does the entire process and as long as the connecting account can be impersonated.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;File ownership can be a bit confusing.&amp;nbsp; It makes a difference whether the two servers are in the same or different domains and it makes a difference if the same person does the entire process.&amp;nbsp; It all comes down to knowing whether your&lt;br /&gt;account is being impersonated on either server involved.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Author&lt;/b&gt;: &lt;br /&gt;Kevin Cox (SQLCAT), Cindy Gross (Microsoft Premier Field Engineering)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Contributors:&lt;/b&gt; Chuck Spencer (Pearson/eCollege)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Reviewers: &lt;/b&gt;Sanjay Mishra, Shawn Tinline-Jones, James Podgorski&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10176978" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Manageability+_2600_amp_3B00_+Serviceability/">Manageability &amp;amp; Serviceability</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+2008+R2/">SQL Server 2008 R2</category></item><item><title>Unexpected Consequences of Multiple Result Sets</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/05/31/unexpected-consequences-of-multiple-result-sets.aspx</link><pubDate>Tue, 31 May 2011 18:24:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10170027</guid><dc:creator>ChuckHeinzelman</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10170027</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/05/31/unexpected-consequences-of-multiple-result-sets.aspx#comments</comments><description>&lt;p&gt;&lt;b&gt;Author:&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Chuck Heinzelman&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Reviewers:&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Kevin Cox, Kun Cheng, Michael Thomassy&lt;/p&gt;
&lt;p&gt;In a recent customer engagement, I was presented with a problem that I have seen in the past and am surprised that I don&amp;rsquo;t see more often.&lt;/p&gt;
&lt;p&gt;Take the following table as an example:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;CREATE TABLE dbo.ResultSetTest&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;(&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; TestData varchar(255) NOT NULL&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is a simple table with an Identity column &amp;ndash; I&amp;rsquo;m sure most of us have a table like this (with more columns, of course) in the systems that we work with.&lt;/p&gt;
&lt;p&gt;The customer had code to insert a new row into the table and return to the calling application the value assigned to the ID column.&amp;nbsp; The code was similar to the following:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;INSERT INTO dbo.ResultSetTest&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;(TestData)&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;VALUES&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;(&amp;lsquo;Test&amp;rsquo;);&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;SELECT @@Identity AS ID;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Given this T-SQL batch, how many result sets would you expect to receive?&amp;nbsp; If you answered 1 I would not be surprised &amp;ndash; as this is what my customer was expecting.&amp;nbsp; In fact &amp;ndash; depending on the driver and execution method used (we were using the Microsoft JDBC Driver for SQL Server) &amp;ndash; this T-SQL batch can generate 2 result sets (which is what my customer was seeing).&amp;nbsp; The first result set (from the INSERT statement) was empty, and the second result set (from the SELECT statement) contained the value of the ID column.&lt;/p&gt;
&lt;p&gt;So, how do you handle a situation like this?&amp;nbsp; I can think of several ways:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Change Your Code &amp;ndash; You could change the code to move to the second result set in the collection of result sets that are returned.&amp;nbsp; This would allow you to get the value of the ID column without changing your T-SQL batch.&amp;nbsp; You can find an example of how to accomplish this with the Microsoft JDBC driver on the Microsoft JDBC Driver Team Blog (&lt;a href="http://blogs.msdn.com/b/jdbcteam/archive/2008/08/01/use-execute-and-getmoreresults-methods-for-those-pesky-complex-sql-queries.aspx"&gt;http://blogs.msdn.com/b/jdbcteam/archive/2008/08/01/use-execute-and-getmoreresults-methods-for-those-pesky-complex-sql-queries.aspx&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Use a Stored Procedure &amp;ndash; You could use a stored procedure to output the value of the ID column as either the return value (provided it is an integer type) or through an output parameter.&amp;nbsp; Using stored procedures is a long-standing best practice and it allows you to have more control over the results being returned.&amp;nbsp; Also, consider including SET NOCOUNT ON in your stored procedure definition to exclude extraneous rows affected messages.&lt;/li&gt;
&lt;li&gt;Change Your T-SQL Batch &amp;ndash; By rewriting the batch into a single statement, you can work around the multiple result sets without any other code changes.&amp;nbsp; The new statement looked something like this:&lt;/li&gt;
&lt;/ol&gt;
&lt;p style="padding-left: 60px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;INSERT INTO dbo.ResultSetTest&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 60px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;(TestData)&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 60px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;OUTPUT Inserted.ID&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 60px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;VALUES&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;(&amp;lsquo;Test&amp;rsquo;);&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&amp;nbsp;More information about the OUTPUT clause can be found in SQL Server Books Online at &lt;a href="http://msdn.microsoft.com/en-us/library/ms177564.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms177564.aspx&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;When writing T-SQL statements and batches, you need to be aware of the clients that your data consumers will be using to retrieve the data.&amp;nbsp; Different drivers can act differently, and you need to be prepared when you get calls saying &amp;ldquo;The statement you wrote is not doing what it should be doing!&amp;rdquo;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10170027" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/OUTPUT/">OUTPUT</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Batch/">Batch</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/T_2D00_SQL/">T-SQL</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/JDBC/">JDBC</category></item><item><title>Announcing SSAS Maestros v1.2</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/05/12/announcing-ssas-maestros-v1-2.aspx</link><pubDate>Thu, 12 May 2011 00:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10163592</guid><dc:creator>Denny Lee [MSFT]</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10163592</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/05/12/announcing-ssas-maestros-v1-2.aspx#comments</comments><description>&lt;p&gt;We are proud to announce that &lt;a href="http://sqlcat.com/"&gt;&lt;span style="color: #265e15;"&gt;SQLCAT&lt;/span&gt;&lt;/a&gt; will continue with the SSAS Maestros course in June and July in Redmond and Madrid. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;SSAS Maestros 1.2 Courses&lt;/h3&gt;
&lt;p&gt;Join us for a five-day deep-dive course on Analysis Services 2008 R2 UDM and join the SSAS Maestro Program. Prepared and presented by &lt;a href="http://sqlcat.com/"&gt;&lt;span style="color: #265e15;"&gt;SQLCAT&lt;/span&gt;&lt;/a&gt;, top industry experts and the SQL Server Analysis Server team, this intensive 500-level course gives top SSAS professionals the education and hands-on experience needed to deliver highly complex and highly scalable OLAP solutions using Analysis Services 2008 R2. Registration requires screening and approval of qualified attendees. Click on the links below for more details. &lt;/p&gt;
&lt;p&gt;&lt;a href="https://msevents.microsoft.com/CUI/InviteOnly.aspx?EventID=F0-A2-32-F0-77-58-EE-22-44-BF-59-9C-08-A5-B9-4A&amp;amp;Culture=en-US"&gt;&lt;span style="color: #265e15;"&gt;SSAS Maestro Program - Redmond, WA- June 13-17&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="https://msevents.microsoft.com/CUI/InviteOnly.aspx?EventID=17-E4-90-F6-55-61-8E-B9-86-1E-D8-03-9F-0F-F4-CD&amp;amp;Culture=en-US"&gt;&lt;span style="color: #265e15;"&gt;SSAS Maestro Program - Madrid, Spain - July 18-22&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The v1.2 of the SSAS Maestros course has been updated based on our learnings from the v1.0 course. How well did people like SSAS Maestros v1.0? Linked is &lt;strong&gt;Vidas Matelis&lt;/strong&gt;' [&lt;a href="http://www.ssas-info.com/VidasMatelisBlog/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/VidasM"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;] opinion of the course: &lt;a href="http://www.ssas-info.com/VidasMatelisBlog/213_ssas-maestro-program-my-experience-so-far"&gt;&lt;span style="color: #265e15;"&gt;SSAS Maestro program &amp;ndash; my experience so far&lt;/span&gt;&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We are also proud to announce the first set of SSAS Maestros Instructors that will be leading the v1.2 effort as well. &lt;/p&gt;
&lt;p&gt;In &lt;strong&gt;Redmond&lt;/strong&gt;, we are fortunate to have BI industry experts &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stacia Misner&lt;/strong&gt; [&lt;a href="http://blog.datainspirations.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/StaciaMisner"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;] &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Adam Jorgensen&lt;/strong&gt; [&lt;a href="http://www.adamjorgensen.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/adam_jorgensen"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;]&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Denny Lee&lt;/strong&gt; [&lt;a href="http://dennyglee.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/dennylee"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;] and &lt;strong&gt;John Sirmon&lt;/strong&gt; [&lt;a href="http://ssascat.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/elcid98"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;] will be the SQLCAT representatives.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And in &lt;strong&gt;Madrid&lt;/strong&gt;, we are fortunate to have the BI gurus: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Marco Russo&lt;/strong&gt; [&lt;a href="http://sqlblog.com/blogs/marco_russo/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt; | &lt;a href="http://twitter.com/marcorus"&gt;&lt;span style="color: #265e15;"&gt;twitter&lt;/span&gt;&lt;/a&gt;]&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chris Webb&lt;/strong&gt; [&lt;a href="http://cwebbbi.wordpress.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt;]&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Thomas Kejser&lt;/strong&gt; [&lt;a href="http://kejserbi.wordpress.com/"&gt;&lt;span style="color: #265e15;"&gt;blog&lt;/span&gt;&lt;/a&gt;] will be the SQLCAT representative&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To keep current on SSAS Maestros, don&amp;rsquo;t forget to follow the hash tag &lt;em&gt;#SSASMaestro&lt;/em&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;SSAS Maestro v1.0 Update&lt;/h3&gt;
&lt;p&gt;But how about all of the folks who completed Round 1 of SSAS Maestros in Redmond, Hong Kong, and London? Apologies for the delay but it has taken a bit longer than we had originally anticipated to complete the evaluations. &lt;/p&gt;
&lt;p&gt;Our partner &lt;a href="http://www.solidq.com/us-en/Pages/Home.aspx"&gt;&lt;strong&gt;&lt;span style="color: #265e15;"&gt;Solid Quality&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;, CSS, and us are currently going through the evaluation process and we believe the evaluations will be completed by June/July time frame. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So stay tuned!! (another great way to stay tuned is to follow @sqlcat and/or search #SSASMaestro) &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10163592" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/analysis+services/">analysis services</category></item><item><title>SQL Server Migration Assistant (SSMA) v5.0 just released!</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/04/30/sql-server-migration-assistant-ssma-v5-0-just-released.aspx</link><pubDate>Sat, 30 Apr 2011 21:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10159773</guid><dc:creator>Mike Weiner - MSFT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10159773</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/04/30/sql-server-migration-assistant-ssma-v5-0-just-released.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-family: times new roman,times; color: #000000; font-size: small;"&gt;Exciting news as earlier this week the SQL Server Product Group announced the release of SQL Server Migration Assistant (SSMA) v5.0! A product with the goal of&amp;nbsp;further simplifying the user experience in automating the migration of Oracle, Sybase, MySQL and Microsoft Access databases to SQL Server or SQL Azure. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: times new roman,times; color: #000000; font-size: small;"&gt;&lt;o:p&gt;In this release, SSMA family of products has been improved to further to reduce the cost and the risk of migration from Sybase, Oracle, MySQL and Microsoft Access. Additional functionality includes: &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family: times new roman,times; color: #000000; font-size: small;"&gt;&lt;o:p&gt;Migrating to SQL Server "Denali", &lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: times new roman,times; color: #000000; font-size: small;"&gt;&lt;o:p&gt;Globalization support for migrating non-English databases to SQL Server, &lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: times new roman,times; color: #000000; font-size: small;"&gt;&lt;o:p&gt;Support for installation of an extension pack&amp;nbsp;on clustered SQL Server environments&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: times new roman,times; color: #000000; font-size: small;"&gt;&lt;o:p&gt;A&amp;nbsp;number of enhancements focused on Sybase and Oracle migration,&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: times new roman,times; color: #000000; font-size: small;"&gt;&lt;o:p&gt;Improved scale and performance of the migration itself. &lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-family: times new roman,times; color: #000000; font-size: small;"&gt;For full details about the release and free product downloads please access the &lt;a href="http://blogs.msdn.com/b/ssma/archive/2011/04/28/sql-server-migration-assistant-v5-0-is-now-available.aspx" title="SSMA Team Blog"&gt;SSMA Team Blog&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10159773" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Migration+and+Transition/">Migration and Transition</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+Migration/">SQL Server Migration</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SSMA/">SSMA</category></item><item><title>Optimize Recursive CTE Query</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/04/28/optimize-recursive-cte-query.aspx</link><pubDate>Thu, 28 Apr 2011 20:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10159277</guid><dc:creator>shauntj-us</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10159277</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/04/28/optimize-recursive-cte-query.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;Author&lt;/strong&gt;: Shaun Tinline-Jones &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reviewers:&lt;/strong&gt; Lubor Kollar; Conor Cunningham; Steve Howard; Kun Cheng; James Podgorski; Jimmy May; Joseph Sack; Welly Lee; Neeraj Joshi; Keith Bauer &lt;/p&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;We recently assisted a global ISV to address a performance issue related to a poor performing recursive CTE (Common Table Expression). The ISV wanted the query that was running in excess of 3 minutes to run in less than 15 seconds on their servers. The end result of our efforts was a &lt;strong&gt;3,600% performance improvement&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Validation for this post was performed in the SQL CAT Customer Lab on an HP Proliant DL380 G7, Westmere-EP X5680 3.33GHz 2 socket, 6 physical cores, 12 logical cores for a total of 24 cores; 144GB RAM. &lt;/p&gt;
&lt;p&gt;A CTE (&lt;a href="http://msdn.microsoft.com/en-us/library/ms186243.aspx"&gt;&lt;span style="color: #669966;"&gt;http://msdn.microsoft.com/en-us/library/ms186243.aspx&lt;/span&gt;&lt;/a&gt;), amongst other things, is a very effective single statement for handling hierarchial data, and more specifically, parent-child relationships. A CTE is a reasonable choice when the intention is to iterate through the data, particularly in cases where the schema cannot be changed but recursive queries are required. If you can design a different schema layout, there are often much faster ways to execute queries over hierarchies. CTEs are also a natural choice when converting a CONNECT BY statement from alternative RDBMS platforms (&lt;a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries003.htm"&gt;&lt;span style="color: #669966;"&gt;http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries003.htm&lt;/span&gt;&lt;/a&gt;). &lt;/p&gt;
&lt;p&gt;There is a scenario where using a CTE construct is significantly &lt;em&gt;less&lt;/em&gt; efficient than the traditional approach to traversing the Parent-Child construct. This blog will describe how and when a WHILE loop performs better than the CTE. The characteristics that can contribute to CTEs being a less than optimal choice are: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Non-Unique Parent/Child Key &lt;/li&gt;
&lt;li&gt;Complex Predicates&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In our scenario the ISV was attempting to extract all the items that adhered to a certain set of characteristics. An item could exist on its own or be a component (child) within a larger item (parent) and there were no constraints to the number of parents a child could have. For this scenario, the query was recursively traversing the hierarchy in a non-unique fashion. &lt;/p&gt;
&lt;p&gt;Below is the original CTE code:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span class="kwrd"&gt;WITH&lt;/span&gt; CTE(ItemID, StartPt, StartID, EndPt, EndID, &lt;span class="kwrd"&gt;level&lt;/span&gt;) &lt;br /&gt;&lt;span class="kwrd"&gt;AS&lt;/span&gt;&lt;br /&gt;(&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="rem"&gt;-- Anchor member definition&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;SELECT&lt;/span&gt; anc.ItemID, anc.StartPt, anc.StartID, anc.EndPt, anc.EndID,0 &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;FROM&lt;/span&gt; dbo.CTEIssue &lt;span class="kwrd"&gt;AS&lt;/span&gt; anc&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;WHERE&lt;/span&gt; anc.StartPt = -1512034855 &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;AND&lt;/span&gt; anc.StartID = 1809069910&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;AND&lt;/span&gt; anc.Category &lt;span class="kwrd"&gt;IN&lt;/span&gt;(-379491138,-379518300,-379520626,472917509,-379494005,-379506005,-2134852210,-379515627,-379515134,-379484415) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;UNION&lt;/span&gt; &lt;span class="kwrd"&gt;ALL&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="rem"&gt;-- Recursive member definition&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;SELECT&lt;/span&gt; chi.ItemID, chi.StartPt, chi.StartID, chi.EndPt, chi.EndID, par.&lt;span class="kwrd"&gt;level&lt;/span&gt;+1 &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;FROM&lt;/span&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbo.CTEIssue &lt;span class="kwrd"&gt;AS&lt;/span&gt; chi&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;INNER&lt;/span&gt; &lt;span class="kwrd"&gt;JOIN&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CTE &lt;span class="kwrd"&gt;AS&lt;/span&gt; par &lt;span class="kwrd"&gt;ON&lt;/span&gt;(par.EndPt = chi.StartPt &lt;span class="kwrd"&gt;AND&lt;/span&gt; par.EndID = chi.StartID)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;WHERE&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; chi.Category &lt;span class="kwrd"&gt;IN&lt;/span&gt;(-379491138,-379518300,-379520626,472917509,-379494005,-379506005,-2134852210,-379515627,-379515134,-379484415)&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; &lt;span class="kwrd"&gt;DISTINCT&lt;/span&gt; cti.* &lt;br /&gt;&lt;span class="kwrd"&gt;FROM&lt;/span&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbo.CTEIssue &lt;span class="kwrd"&gt;AS&lt;/span&gt; cti&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="kwrd"&gt;INNER&lt;/span&gt; &lt;span class="kwrd"&gt;JOIN&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CTE &lt;span class="kwrd"&gt;AS&lt;/span&gt; cte &lt;span class="kwrd"&gt;ON&lt;/span&gt;(cti.ItemID = cte.ItemID)&lt;br /&gt;&lt;span class="kwrd"&gt;WHERE&lt;/span&gt; (cti.EndPt &amp;lt;&amp;gt; -1512034855 &lt;span class="kwrd"&gt;OR&lt;/span&gt; cti.Category = -379484415) &lt;br /&gt;&lt;span class="kwrd"&gt;GO&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Identifying the issue&lt;/h1&gt;
&lt;p&gt;Firstly, we understand that there are cases where an inefficient query is acceptable, provided that it meets the intended objectives. It only becomes an issue when the intended objectives are not attained. In this case, the inefficient CTE meets the expected response times for small data sets or simple predicates and only became an issue once the data set became large and the throughput increased. Another concept to appreciate is that there are cases where a slow operation for small data sets is significantly faster when dealing with larger data sets. For example, nested joins are great for small sets of data but are typically no match for hash joins when the data is large. &lt;/p&gt;
&lt;p&gt;It's relatively easy to recognize that using CTEs is not the most efficient approach when the statement immediately following the CTE expression relies on the DISTINCT of all the columns. Essentially this implies that the recursive logic doesn't have a primary key in the anchor, and thereby allowing each recursive member to not be unique. This creates a scenario where a huge number of duplicate rows are generated. &lt;/p&gt;
&lt;p&gt;Another way to recognize that a CTE is inefficient is to compare the estimated query plan statistics to the actual statistics. The below table highlights the difference between the query plan Estimates versus Actuals.&lt;/p&gt;
&lt;table unselectable="on" cellpadding="0" cellspacing="0" border="1" style="width: 600px; border: #000000 1px solid;"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width="75"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;Estimate Rows&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;Estimate Executions&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;Rows&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;Executes&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;TruncatedOperatorText (First 60 characters)&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;183.53&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;NULL&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;3&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;WITH CTE(ItemID, StartPt, StartID, EndPt, EndID, level) AS&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;35.22541&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;3&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;|--Nested Loops(Inner Join, OUTER REFERENCES:([Recr1014]&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;35.22541&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;299197&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;|--Hash Match(Aggregate, HASH:([Recr1014]), RESIDUAL:&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1240.829&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4129317&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| |--Index Spool(WITH STACK)&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1240.829&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4129317&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| |--Concatenation&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1241.829&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| |--Compute Scalar(DEFINE:([Expr1021]=(&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1237.773&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| | |--Compute Scalar(DEFINE:([Expr10&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1237.773&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1723&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| | |--Nested Loops(Inner Join, &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1237.773&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1723&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| | |--Index Seek(OBJECT:([&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1237.773&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1723&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1723&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| | |--Clustered Index Seek&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1.002469&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1241.829&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4127594&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| |--Assert(WHERE:(CASE WHEN [Expr1023]&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1.002469&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1241.829&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4127594&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| |--Nested Loops(Inner Join, OUTER&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1241.829&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| |--Compute Scalar(DEFINE:([E&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1241.829&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4129317&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| | |--Table Spool(WITH STA&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;3.055948&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1240.829&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| |--Compute Scalar(DEFINE:([E&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;3.055948&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1240.829&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4127594&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4129317&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| |--Nested Loops(Inner J&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;3.055948&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1240.829&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4127594&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4129317&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| |--Index Seek(OBJE&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;3791.91&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="70" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4127594&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;4127594&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;| |--Clustered Index&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="75" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="90" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;35.22541&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="76" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;3&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="87" valign="top"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;299197&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="353" valign="bottom"&gt;
&lt;p&gt;&lt;span style="font-size: xx-small;"&gt;|--Clustered Index Seek(OBJECT:([MCC2].[dbo].[CTEIssu&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;As you can see - in some cases the estimated rows versus actual rows were significantly skewed. &lt;/p&gt;
&lt;h1&gt;Improving the performance&lt;/h1&gt;
&lt;p&gt;The objective of that query was to identify unique rows and remove them from the recursive iteration. &lt;b&gt;If this can be done in the CTE, then that would be ideal&lt;/b&gt;, otherwise a more performant alternative is to convert the query into WHILE loop. The CTE is far more efficient than WHILE loop if there is a unique parent/child key. However let me emphasize that when you have non-unique parent/child keys, estimations used to create the query plan is likely to be significantly skewed. &lt;/p&gt;
&lt;p&gt;Below is the code that meets the objective of been more restrictive during each iteration. It is followed by an explanation of the reasoning behind the construction of the query, and why it performs better: &lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;SET&lt;/span&gt; NOCOUNT &lt;span class="kwrd"&gt;ON&lt;/span&gt;

&lt;span class="kwrd"&gt;DECLARE&lt;/span&gt; @StartPt &lt;span class="kwrd"&gt;int&lt;/span&gt; = -1512034855;
&lt;span class="kwrd"&gt;DECLARE&lt;/span&gt; @StartID &lt;span class="kwrd"&gt;int&lt;/span&gt; = 1809069910;
&lt;span class="kwrd"&gt;DECLARE&lt;/span&gt; @Counter tinyint = 0;
&lt;span class="kwrd"&gt;DECLARE&lt;/span&gt; @MaxRecursion tinyint = 50;

&lt;span class="kwrd"&gt;DECLARE&lt;/span&gt; @CategoryList &lt;span class="kwrd"&gt;table&lt;/span&gt;(Category &lt;span class="kwrd"&gt;int&lt;/span&gt; &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;)

&lt;span class="kwrd"&gt;DECLARE&lt;/span&gt; @PtIDPair &lt;span class="kwrd"&gt;table&lt;/span&gt;
(
    Pt        &lt;span class="kwrd"&gt;int&lt;/span&gt;        &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt; 
    ,ID        &lt;span class="kwrd"&gt;int&lt;/span&gt;        &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
    ,lvl    tinyint    &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
    ,&lt;span class="kwrd"&gt;PRIMARY&lt;/span&gt; &lt;span class="kwrd"&gt;KEY&lt;/span&gt; &lt;span class="kwrd"&gt;CLUSTERED&lt;/span&gt; (lvl, Pt, ID)
)

&lt;span class="kwrd"&gt;CREATE&lt;/span&gt; &lt;span class="kwrd"&gt;TABLE&lt;/span&gt; #Item
    (
      ItemID     &lt;span class="kwrd"&gt;int&lt;/span&gt; &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
      ,Category     &lt;span class="kwrd"&gt;int&lt;/span&gt; &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
      ,StartPt &lt;span class="kwrd"&gt;int&lt;/span&gt; &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
      ,StartID     &lt;span class="kwrd"&gt;int&lt;/span&gt; &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
      ,EndPt     &lt;span class="kwrd"&gt;int&lt;/span&gt; &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
      ,EndID     &lt;span class="kwrd"&gt;int&lt;/span&gt; &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
      ,lvl         tinyint &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
    )

&lt;span class="kwrd"&gt;CREATE&lt;/span&gt; &lt;span class="kwrd"&gt;CLUSTERED&lt;/span&gt; &lt;span class="kwrd"&gt;INDEX&lt;/span&gt; CDX_#Item_Lvl &lt;span class="kwrd"&gt;ON&lt;/span&gt; #Item ([lvl])
&lt;span class="kwrd"&gt;CREATE&lt;/span&gt; &lt;span class="kwrd"&gt;NONCLUSTERED&lt;/span&gt; &lt;span class="kwrd"&gt;INDEX&lt;/span&gt; NDX_#Item_ItemID &lt;span class="kwrd"&gt;ON&lt;/span&gt; #Item (ItemID)

INSERT &lt;span class="kwrd"&gt;INTO&lt;/span&gt; @CategoryList 
&lt;span class="kwrd"&gt;VALUES&lt;/span&gt;
    (-379491138)
    ,(-379518300)
    ,(-379520626)
    ,(472917509)
    ,(-379494005)
    ,(-379506005)
    ,(-2134852210)
    ,(-379515627)
    ,(-379515134)
    ,(-379484415);

--Gather the anchors
&lt;span class="rem"&gt;-- There are a set of ItemID values, which happens to contain a common&lt;/span&gt;
&lt;span class="rem"&gt;-- Pt/Id combination.  These are level 0 (Anchors)&lt;/span&gt;
INSERT &lt;span class="kwrd"&gt;INTO&lt;/span&gt; #Item
    (ItemID, Category, StartPt, StartID, EndPt, EndID, lvl)
&lt;span class="kwrd"&gt;SELECT&lt;/span&gt;
    ItemID, cti.Category, StartPt, StartID, EndPt, EndID, @Counter
&lt;span class="kwrd"&gt;FROM&lt;/span&gt;    
    dbo.CTEIssue &lt;span class="kwrd"&gt;AS&lt;/span&gt; cti
    &lt;span class="kwrd"&gt;INNER&lt;/span&gt; &lt;span class="kwrd"&gt;JOIN&lt;/span&gt;
    @CategoryList &lt;span class="kwrd"&gt;AS&lt;/span&gt; lst &lt;span class="kwrd"&gt;ON&lt;/span&gt;(lst.Category = cti.Category)
&lt;span class="kwrd"&gt;WHERE&lt;/span&gt;
    StartPt = @StartPt
    &lt;span class="kwrd"&gt;AND&lt;/span&gt; StartID = @StartID

&lt;span class="rem"&gt;-- We want to remove the duplicates, from the final result set, so we do our filtering to create a unique set of anchor pairs&lt;/span&gt;
INSERT &lt;span class="kwrd"&gt;INTO&lt;/span&gt; @PtIDPair(Pt, ID, lvl) 
&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; EndPt, EndID, @Counter
&lt;span class="kwrd"&gt;FROM&lt;/span&gt; #Item
&lt;span class="kwrd"&gt;WHERE&lt;/span&gt; lvl = @Counter
&lt;span class="kwrd"&gt;GROUP&lt;/span&gt; &lt;span class="kwrd"&gt;BY&lt;/span&gt; EndPt, EndID

&lt;span class="kwrd"&gt;WHILE&lt;/span&gt; &lt;span class="preproc"&gt;@@ROWCOUNT&lt;/span&gt; &amp;gt; 0
 &lt;span class="kwrd"&gt;BEGIN&lt;/span&gt;
    &lt;span class="kwrd"&gt;SET&lt;/span&gt; @Counter += 1
    
    &lt;span class="kwrd"&gt;IF&lt;/span&gt; @Counter = 50
     &lt;span class="kwrd"&gt;BEGIN&lt;/span&gt;
        &lt;span class="kwrd"&gt;RAISERROR&lt;/span&gt;(&lt;span class="str"&gt;'Max Recursion reached'&lt;/span&gt;, 16, 1)
        &lt;span class="kwrd"&gt;BREAK&lt;/span&gt;
     &lt;span class="kwrd"&gt;END&lt;/span&gt;
    
    INSERT &lt;span class="kwrd"&gt;INTO&lt;/span&gt; #Item(ItemID, Category, StartPt, StartID, EndPt, EndID, lvl)
    &lt;span class="kwrd"&gt;SELECT&lt;/span&gt;    cti.ItemID, cti.Category, cti.StartPt, cti.StartID, cti.EndPt, cti.EndID, @Counter
    &lt;span class="kwrd"&gt;FROM&lt;/span&gt;    
        dbo.CTEIssue &lt;span class="kwrd"&gt;AS&lt;/span&gt; cti
        &lt;span class="kwrd"&gt;INNER&lt;/span&gt; &lt;span class="kwrd"&gt;JOIN&lt;/span&gt;
        @CategoryList &lt;span class="kwrd"&gt;AS&lt;/span&gt; lst &lt;span class="kwrd"&gt;ON&lt;/span&gt;(lst.Category = cti.Category)
        &lt;span class="kwrd"&gt;INNER&lt;/span&gt; &lt;span class="kwrd"&gt;JOIN&lt;/span&gt;
        @PtIDPair &lt;span class="kwrd"&gt;AS&lt;/span&gt; pr &lt;span class="kwrd"&gt;ON&lt;/span&gt;(cti.StartPt = pr.Pt &lt;span class="kwrd"&gt;AND&lt;/span&gt; cti.StartID = pr.ID)
        &lt;span class="kwrd"&gt;LEFT&lt;/span&gt; &lt;span class="kwrd"&gt;OUTER&lt;/span&gt; &lt;span class="kwrd"&gt;JOIN&lt;/span&gt;
        #Item &lt;span class="kwrd"&gt;AS&lt;/span&gt; itm &lt;span class="kwrd"&gt;ON&lt;/span&gt;(itm.ItemID = cti.ItemID)
    &lt;span class="kwrd"&gt;WHERE&lt;/span&gt;
        itm.ItemID &lt;span class="kwrd"&gt;IS&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
        &lt;span class="kwrd"&gt;AND&lt;/span&gt; pr.lvl = @Counter - 1

    INSERT &lt;span class="kwrd"&gt;INTO&lt;/span&gt; @PtIDPair(Pt, ID, lvl) 
    &lt;span class="kwrd"&gt;SELECT&lt;/span&gt; itm.EndPt, itm.EndID, @Counter
    &lt;span class="kwrd"&gt;FROM&lt;/span&gt; 
        #Item &lt;span class="kwrd"&gt;AS&lt;/span&gt; itm
        &lt;span class="kwrd"&gt;LEFT&lt;/span&gt; &lt;span class="kwrd"&gt;OUTER&lt;/span&gt; &lt;span class="kwrd"&gt;JOIN&lt;/span&gt;
        @PtIDPair &lt;span class="kwrd"&gt;AS&lt;/span&gt; pr &lt;span class="kwrd"&gt;ON&lt;/span&gt;(itm.EndPt = pr.Pt &lt;span class="kwrd"&gt;AND&lt;/span&gt; itm.EndID = pr.ID)
    &lt;span class="kwrd"&gt;WHERE&lt;/span&gt;
        pr.ID &lt;span class="kwrd"&gt;IS&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;
        &lt;span class="kwrd"&gt;AND&lt;/span&gt; itm.lvl = @Counter
    &lt;span class="kwrd"&gt;GROUP&lt;/span&gt; &lt;span class="kwrd"&gt;BY&lt;/span&gt;
        itm.EndPt, itm.EndID
 &lt;span class="kwrd"&gt;END&lt;/span&gt;

&lt;span class="kwrd"&gt;SELECT&lt;/span&gt;
    cti.*
&lt;span class="kwrd"&gt;FROM&lt;/span&gt; 
    dbo.CTEIssue &lt;span class="kwrd"&gt;AS&lt;/span&gt; cti
    &lt;span class="kwrd"&gt;INNER&lt;/span&gt; &lt;span class="kwrd"&gt;JOIN&lt;/span&gt;
    #Item &lt;span class="kwrd"&gt;AS&lt;/span&gt; itm &lt;span class="kwrd"&gt;ON&lt;/span&gt;(cti.ItemID = itm.ItemID)
&lt;span class="kwrd"&gt;WHERE&lt;/span&gt; 
    cti.EndPt &amp;lt;&amp;gt; -1512034855
    &lt;span class="kwrd"&gt;OR&lt;/span&gt; cti.Category = -379484415
&lt;span class="kwrd"&gt;GO&lt;/span&gt;
&lt;/pre&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Side Note&lt;/span&gt;: Our investigations revealed that in this case table variables significantly outperformed local temp tables. &lt;/p&gt;
&lt;p&gt;The first step was to declare variables and create a temporary table to store the equivalent of the CTE result set. A table variable was used to store the unique JOIN clause rows generated during the iterations. Just before entering the WHILE&amp;hellip;END, we created the first record (a.k.a the Anchor Member). In the WHILE&amp;hellip;END loop we found all the children based on the JOIN criteria, further filtered by the predicates, and inserted them into the list of unique records. The next iteration would not collect the same children again. This was the most important distinction. &lt;/p&gt;
&lt;h3&gt;Improving the CTE Query Plan&lt;/h3&gt;
&lt;p&gt;Compared to the CTE, the WHILE loop is a fair amount of coding. Prior to re-writing the CTE as a WHILE loop, we attempted to optimize the query plan itself, within the constraint of not being able to generate unique values in the join. We modified the CTE to use a table variable versus using an IN clause. We created indexes and updated the statistics, and achieved a 50% performance improvement, but unfortunately and more importantly missing the objective of improving by at least a factor of 12. &lt;/p&gt;
&lt;p&gt;Below are the STATISTICS IO and TIME demonstrating the improvement of adding the TVP and indexes: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Original&lt;/b&gt; &lt;/p&gt;
&lt;p&gt;(3 row(s) affected) &lt;/p&gt;
&lt;p&gt;Table 'CTEIssue'. Scan count 41,592,377, logical reads 137,303,190, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. &lt;/p&gt;
&lt;p&gt;Table 'Worktable'. Scan count 2, logical reads 24,576,797, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. &lt;/p&gt;
&lt;p&gt;SQL Server Execution Times: CPU time = 209197ms, elapsed time = 217344ms. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;with TVP&lt;/b&gt; &lt;/p&gt;
&lt;p&gt;(3 row(s) affected) &lt;/p&gt;
&lt;p&gt;Table 'CTEIssue'. Scan count 4,428,524, logical reads 41,930,102, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. &lt;/p&gt;
&lt;p&gt;Table 'Worktable'. Scan count 2, logical reads 24,575,641, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. &lt;/p&gt;
&lt;p&gt;Table '#6EF57B66'. Scan count 1, logical reads 19,007,602, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. &lt;/p&gt;
&lt;p&gt;SQL Server Execution Times: CPU time = 143646ms, elapsed time = 151268ms.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;b&gt;Side Note&lt;/b&gt;: Table variables do not maintain statistics and are generally not recommended when there are cost-based plan choices that can result in significant performance variability; one would typically leverage a local temporary table in that case. We used a TVP here because the ISV application was creating an IN clause that could reach hundreds of values, and a table variable data type was more robust, and in some cases more efficient. &lt;/p&gt;
&lt;p&gt;When we compare the query plans between the CTE and the WHILE loop, we realized that each iteration of the WHILE loop, has the luxury of a different query plan. This is unlike the CTE which only executed against one query plan. &lt;/p&gt;
&lt;p&gt;A significant contribution to the long running nature of the CTE query is this portion of the query plan that estimates less than 10 rows on the outer and inner query, but ends up having to iterate through millions of rows on both sides of the query. For a table that only has a few hundred thousand rows, this is a function of the lack of unique join criteria. &lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-50-01/1222.Image4RecursiveCTEBlog01.png" alt="Query Plan Statistics" title="Query Plan Statistics" style="display: block; float: none; margin-left: auto; margin-right: auto;" /&gt; &lt;/p&gt;
&lt;h1&gt;In Conclusion&amp;hellip;&lt;/h1&gt;
&lt;p&gt;The Common Table Expression (CTE) is a powerful syntax in its ability to address the historically challenging objective of recursive queries using T-SQL. It is a natural and often times appropriate syntax when migrating from the CONNECT BY syntax. Recursive CTE queries do have a reliance on the unique parent/child keys in order to get the best performance. If this is not possible to achieve, then a WHILE loop is potentially a much more efficient approach to handling the recursive query. &lt;/p&gt;
&lt;p&gt;Our final results completed this frequently run query within 4 seconds from 144 seconds, a &lt;b&gt;3600% performance improvement&lt;/b&gt;!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10159277" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Performance+and+Scalability/">Performance and Scalability</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Query+performance/">Query performance</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+Best+Practices/">SQL Server Best Practices</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/sql/">sql</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+2008+R2/">SQL Server 2008 R2</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+2008/">SQL Server 2008</category></item><item><title>32- and 64-Bit Connectivity from the Same Machine</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/03/31/32-and-64-bit-connectivity-from-the-same-machine.aspx</link><pubDate>Thu, 31 Mar 2011 15:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10148274</guid><dc:creator>ChuckHeinzelman</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10148274</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/03/31/32-and-64-bit-connectivity-from-the-same-machine.aspx#comments</comments><description>&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;strong&gt;Author: Chuck Heinzelman&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;strong&gt;Reviewers: Steve Howard, Carl Rabeler, Shaun Tinline-Jones, Mike Weiner, Murshed Zaman&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;I was recently involved in a customer lab testing the Microsoft Business Intelligence stack.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;I noticed an interesting behavior when working on one of my test servers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Here&amp;rsquo;s the environment that I was working with:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Windows Server 2008 R2 (64-bit)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;SQL Server 2008 R2 (64-bit)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;SharePoint 2010 (64-bit)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Excel 2010 with PowerPivot Add-In (64-bit)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Visual Studio 2010 (32-bit)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;See the problem yet?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;I had a mix of 32-bit and 64-bit applications on the same machine.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Many developers and database professionals are running 64-bit operating systems and tools these days.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;For the work that we do, the larger address space that 64-bit processing provides allows us to work with larger data sets and do our jobs better.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;To facilitate this, companies that produce DBMSs and other data sources are shipping 64-bit drivers and connectivity tools to connect to their systems.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;In a mixed-mode environment like the one outlined above, connectivity can prove to be quite tricky.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;You will need to have both a 32-bit and a 64-bit driver loaded on your machine to make this work properly.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In the software scenario outlined above, you would need:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;32-bit driver to work with the data from within the Visual Studio environment&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;64-bit driver to work with the data from within PowerPivot and SharePoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;This problem is not limited to the applications listed above.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;I have seen it crop up in the following arenas as well:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;SSIS &amp;ndash; When running in the BIDS designer (a 32-bit application), you need to have 32-bit drivers installed to use the design-time tools.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;SSIS packages can be run using either the 64-bit or the 32-bit SSIS engine (64-bit is default, but this can be changed by setting the Run64BitRuntime property to false).&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;If you do not have 32-bit drivers installed on your machine, you will not be able to connect to your data sources at design-time.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Also, if you deploy a solution where only 32-bit drivers exist to a 64-bit server, you will need to install the 32-bit drivers on the server and explicitly schedule the package to run using the 32-bit SSIS runtime to use the 32-bit drivers.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;More information can be found in the article &lt;b style="mso-bidi-font-weight: normal;"&gt;64 bit Considerations for Integration Services&lt;/b&gt; on MSDN (&lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms141766.aspx"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;span style="color: #0000ff;"&gt;http://msdn.microsoft.com/en-us/library/ms141766.aspx&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Report Builder &amp;ndash; Report Builder is a 32-bit application, and the design-time experience will require 32-bit drivers.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;When you preview a report, your experience will vary depending on if you are connected to a report server or not.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;If you are connected to a report server, the preview will run in the context of that server and you will need to have the appropriate bit-level drivers installed on the server.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;If you are running disconnected, Report Builder itself will do the rendering using the 32-bit drivers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;If you are using SQL Server as your data source, the 64-bit SQL Native Client installer will install both the 64-bit and 32-bit drivers side-by-side.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;If you are extracting data from a non-Microsoft database platform, you will need to check with the database manufacturer to determine how to install their drivers side-by-side.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;You might also run into this issue when extracting data from data sources such as Microsoft Excel &amp;ndash; which up until Microsoft Excel 2010 did not have a 64-bit version.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;In some cases, you might not be able to install both the 32-bit and 64-bit drivers side-by-side.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In this case, your options are fairly limited.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The easiest way to get around this is to install all of your client tools at the same bit-level &amp;ndash; which could mean running the 32-bit versions of all of your tools on your 64-bit machine.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Conclusion&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Each data source provider is going to have different drivers and different configuration methods, so I cannot go into depth here into how to configure both the 32-bit and 64-bit drivers on the same machine for each provider.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;You might even run into scenarios where the installation procedures are different from one version to the next from the same provider.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The easiest way to get around this problem is to try to run everything at the same bit-level, but that is not always possible.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;If you cannot run everything at the same bit-level, you will need to consult the manufacturer of your data source for their best practices on side-by-side driver installation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Additional Resources&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;64 bit Considerations for Integration Services - &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms141766.aspx"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;span style="color: #0000ff;"&gt;http://msdn.microsoft.com/en-us/library/ms141766.aspx&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Data Sources Supported by Reporting Services (SSRS) - &lt;a href="http://msdn.microsoft.com/en-us/library/ms159219.aspx"&gt;&lt;span style="color: #0000ff;"&gt;http://msdn.microsoft.com/en-us/library/ms159219.aspx&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif';"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;Data Access Technologies Road Map - &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms810810.aspx"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;span style="color: #0000ff;"&gt;http://msdn.microsoft.com/en-us/library/ms810810.aspx&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;How to get a x64 version of Jet? - &lt;/span&gt;&lt;a href="http://blogs.msdn.com/b/psssql/archive/2010/01/21/how-to-get-a-x64-version-of-jet.aspx"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;span style="color: #0000ff;"&gt;http://blogs.msdn.com/b/psssql/archive/2010/01/21/how-to-get-a-x64-version-of-jet.aspx&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;SSIS: 64-bit Story - &lt;/span&gt;&lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/ssis-64-bit-story.aspx"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;span style="color: #0000ff;"&gt;http://social.technet.microsoft.com/wiki/contents/articles/ssis-64-bit-story.aspx&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Tahoma','sans-serif'; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10148274" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SSIS/">SSIS</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+Reporting+Services/">SQL Server Reporting Services</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Integration+Services/">Integration Services</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/PowerPivot/">PowerPivot</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Connectivity/">Connectivity</category></item><item><title>Linked Servers to SQL Azure</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/03/08/linked-servers-to-sql-azure.aspx</link><pubDate>Tue, 08 Mar 2011 02:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10137914</guid><dc:creator>Kevin Cox SQL Server</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10137914</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/03/08/linked-servers-to-sql-azure.aspx#comments</comments><description>&lt;h1 style="line-height: normal; margin: 24pt 0in 0pt;"&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: #0070c0; font-size: 12pt; mso-bidi-font-size: 14.0pt;"&gt;Authors: &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;Kevin Cox &amp;amp; Michael Thomassy &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1 style="line-height: normal; margin: 24pt 0in 0pt;"&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: #0070c0; font-size: 12pt; mso-bidi-font-size: 14.0pt;"&gt;Contributors: Lubor Kollar&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1 style="line-height: normal; margin: 24pt 0in 0pt;"&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: #0070c0; font-size: 12pt; mso-bidi-font-size: 14.0pt;"&gt;Technical Reviewers: Shaun Tinline-Jones, Chuck Heinzelman, Steve Howard, Kun Cheng, Jimmy May&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1 style="margin: 24pt 0in 0pt;"&gt;&lt;span style="font-family: 'Arial','sans-serif';"&gt;&lt;span style="color: #365f91;"&gt;Overview&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Connecting directly to a SQL Azure database from a reporting tool (like Microsoft Excel and PowerPivot, or SQL Server Reporting Services) from your desktop or local data center is possible using a data source that looks like:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;[YourAzureServr@database.windows.net].[YourDatabase]&lt;span style="color: gray;"&gt;.&lt;/span&gt;[YourSchema]&lt;span style="color: gray;"&gt;.[YourTable]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;a name="_GoBack"&gt;&lt;/a&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;This is useful if you have a single database on SQL Azure that you need to query.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;What if you have reached the 50GB limit that is currently the top size of a SQL Azure database?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The solution is to split your database into many databases containing the same schema.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;See &lt;/span&gt;&lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/sharding-with-sql-azure.aspx"&gt;&lt;span style="font-family: Calibri; color: #0000ff; font-size: small;"&gt;this paper&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt; on database sharding with SQL Azure.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Expecting the users to always define multiple data sources to connect to multiple databases is cumbersome and may not perform well. For example, a PowerPivot user would have to open a separate link to every SQL Azure database individually.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This paper describes a solution using a local SQL Server that can ease the access to all these databases and will usually give better performance.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The solution is called Partitioned Views and is implemented using Linked Servers.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Since customers don&amp;rsquo;t usually like to expose their databases to the internet, we are proposing a separate server that contains no actual data and only contains the views necessary for applications to get an internet link to SQL Azure databases.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This is not the only solution because you can implement stored procedures using OPENROWSET or OPENQUERY for solutions that need more logic. &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;A read-only solution is the easiest to implement.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;If modifications must be made to the SQL Azure tables via the Distributed Partitioned Views, you must read the restrictions in SQL Server Books Online.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;It also helps to read about how to &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms188299.aspx"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;implement a partitioned view&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Using the check constraints on the tables as shown in the examples in this link is essential if you want the optimizer to only touch the right tables when you use the constrained columns in a WHERE clause in your queries.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h2 style="margin: 10pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #4f81bd; font-size: medium;"&gt;How does this work?&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;This concept relies on the linked server feature of SQL Server.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Since ADO.NET, ODBC, PHP and JDBC are the only providers currently supported by SQL Azure, ODBC data source names (DSN) are required.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h2 style="margin: 10pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #4f81bd; font-size: medium;"&gt;Setting up an ODBC DSN&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Run odbcad32.exe to setup a system DSN using SQL Server Native Client.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Or go into Control Panel\System and Security\Administrative Tools and click on Data Sources (ODBC).&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Each database you create on SQL Azure needs a separate DSN and a separate linked server definition.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Use TCP, not named pipes because you will be communicating to the SQL Azure servers through the internet.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Scale the creation of ODBC connections to multiple databases by modifying &amp;amp; importing a .REG file into the registry (regedit.exe) patterned after this sample:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\Azure_ODBC1]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;"Driver"="C:\\Windows\\system32\\sqlncli10.dll"&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;"Server"="YourAzureServer"&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;"LastUser"="YourLogin"&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;"Database"="YourDatabaseName"&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;"Azure_ODBC1"="SQL Server Native Client 10.0"&lt;/span&gt;&lt;/p&gt;
&lt;h2 style="margin: 10pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #4f81bd; font-size: medium;"&gt;SQL Server Linked Server&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;An ODBC DSN and an associated Linked Server need to be created for each Database that will be queried.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Here are two sample T-SQL commands that will create a linked server and associated login:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;EXEC&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;master&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;dbo&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: maroon;"&gt;sp_addlinkedserver&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;@server &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;N'Azure_ODBC1'&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;@srvproduct&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: red;"&gt;N'Any'&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; @provider&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: red;"&gt;N'MSDASQL'&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; @datasrc&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: red;"&gt;N'Azure_ODBC1'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;GO&lt;br style="mso-special-character: line-break;" /&gt;&lt;br style="mso-special-character: line-break;" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green;"&gt;/* For security reasons the linked server remote logins password is changed to ######## */&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;EXEC&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;master&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;dbo&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: maroon;"&gt;sp_addlinkedsrvlogin&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;@rmtsrvname&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: red;"&gt;N'Azure_ODBC1'&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;@useself&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: red;"&gt;N'False'&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;@locallogin&lt;span style="color: gray;"&gt;=NULL,&lt;/span&gt;@rmtuser&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: red;"&gt;N'yourlogin@YourAzureServer'&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;@rmtpassword&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: red;"&gt;&amp;rsquo;#####'&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h2 style="margin: 10pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #4f81bd; font-size: medium;"&gt;SQL Azure Limits&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;By default, SQL Azure allows 149 databases per server.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;To exceed this threshold, either 1) create databases in other servers, or 2) contact the Azure business desk and request that your limit be increased from the default threshold.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Each database can be a maximum of 50GB, giving a default total 7.45TB of storage per Server.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Remember to factor in index sizes when planning your total data needs.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The 50GB limit has to cover both data and index space.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Log space is &lt;/span&gt;&lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/sql-azure-faq.aspx"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;considered separate&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt; from the 50GB limit. &lt;/span&gt;&lt;/p&gt;
&lt;h1 style="margin: 24pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #365f91;"&gt;Distributed Partitioned View&lt;/span&gt;&lt;/h1&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;In order to make all your SQL Azure databases appear as one data source, you need to create a distributed partitioned view (DPV) in your local, on-premise SQL Server database.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This database must be at least Enterprise edition because DPVs are not supported in Standard Edition or less.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;This example statement creates the view with two SQL Azure databases on a local SQL Server:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;CREATE&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;VIEW&lt;/span&gt; dbo&lt;span style="color: gray;"&gt;.&lt;/span&gt;dpv_Test &lt;span style="color: blue;"&gt;AS&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: gray;"&gt;*&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; Azure_ODBC0&lt;span style="color: gray;"&gt;.&lt;/span&gt;test0&lt;span style="color: gray;"&gt;.&lt;/span&gt;dbo&lt;span style="color: gray;"&gt;.&lt;/span&gt;fact&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;UNION&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: gray;"&gt;ALL&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;SELECT&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: gray;"&gt;*&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; Azure_ODBC1&lt;span style="color: gray;"&gt;.&lt;/span&gt;test1&lt;span style="color: gray;"&gt;.&lt;/span&gt;dbo&lt;span style="color: gray;"&gt;.&lt;/span&gt;fact&lt;span style="color: gray;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;This is an example of a simple select using a four-part name.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;More complex statements are allowed, such as adding joins and where clauses.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Joins should use four part names in all table references to keep the join work on the same machine.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The worst performance occurs when cross server joins are implemented.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;The simple example above will return all rows from these tables in all databases.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This may be your intention if, for example, you want to bring all the data into PowerPivot for aggregations and pivoting.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Be mindful of the cost for bandwidth of returning all the rows.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;To estimate cost, go to the main &lt;/span&gt;&lt;a href="http://www.microsoft.com/windowsazure/pricing/"&gt;&lt;span style="font-family: Calibri; color: #0000ff; font-size: small;"&gt;Windows Azure pricing site&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The appendix provides a query that can be used at any time to get the current billing estimate.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Be mindful that the billing values reflect current pricing which you are likely to be modified as Azure matures.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Notes:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;It is not the view that is partitioned in a distributed partitioned view, it is the data the view points to that is partitioned.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The data does not have to be partitioned, this view can point to one database and can contain one select. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;The tables being referenced in the view can exist in both SQL Azure and local databases as long as the correct permissions are granted for the appropriate users.&lt;/span&gt;&lt;/p&gt;
&lt;h1 style="margin: 24pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #365f91;"&gt;Use Linked Server to SQL Azure&lt;/span&gt;&lt;/h1&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;There is a simple method for running a query against a single table directly on a SQL Azure server from your application (without using the DPV).&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;As an example, if you open a query window on your local SQL Server Management Studio, while connected to a local instance, you can follow the sample:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: gray;"&gt;*&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; [YourAzureServer@database.windows.net].[YourDatabase]&lt;span style="color: gray;"&gt;.&lt;/span&gt;[YourSchema]&lt;span style="color: gray;"&gt;.[YourTable]&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;To query all the tables on your Azure server from a local server, simply use the view created above:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;SELECT * FROM dpv_Test&lt;/span&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Write to a table through the view:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;INSERT INTO dpv_Test VALUES (1, &amp;lsquo;Test&amp;rsquo;, 1)&lt;/span&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;The first time the view is invoked, either through a select or insert/update/delete command, it will cache the table constraints on the local server.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This gives the view some information about where the insert should be directed and it will only touch that database.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;And if the constraints are used in the WHERE clause of a query, the optimizer will do partition elimination and only touch the databases it needs to touch.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Note:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Beware that distributed partitioned views have several restrictions that are well documented in &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms187075.aspx"&gt;&lt;span style="font-family: Calibri; color: #0000ff; font-size: small;"&gt;B Online&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;(This link is one of many to read, use it as a launch point for the other related pages.)&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h2 style="margin: 10pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #4f81bd; font-size: medium;"&gt;Linked Server Properties&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Linked Servers are only available in SQL Server Enterprise Edition or higher.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;If your view spans multiple Azure data centers, you need to be aware of one more thing before you get started.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;On your local server you need to set the Lazy Schema Validation option to TRUE so that the query is not sent to every server for every command.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The schema check will defer to run time and may fail if the result set formats are incompatible.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New';"&gt;&lt;span style="font-size: small;"&gt;EXEC sp_serveroption 'LocalServerName', 'lazy schema validation', true&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New';"&gt;&lt;span style="font-size: small;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New';"&gt;&lt;span style="font-size: small;"&gt;EXEC sp_serveroption &amp;lsquo;RemoteServerName&amp;rsquo;, &amp;lsquo;lazy schema validation&amp;rsquo;, true&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New';"&gt;&lt;span style="font-size: small;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;Another server level setting that can help performance is to ensure that the collation settings are compatible on all servers.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This is an optimization option and is not required.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;What can happen if the collations are not compatible is the filters supplied by the WHERE clauses do not get applied on the remote server.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Instead, all data is returned by the query and the WHERE clause gets applied on the local machine.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New';"&gt;&lt;span style="font-size: small;"&gt;EXEC sp_serveroption 'LocalServerName', &amp;lsquo;collation compatible&amp;rsquo;, true&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New';"&gt;&lt;span style="font-size: small;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New';"&gt;&lt;span style="font-size: small;"&gt;EXEC sp_serveroption &amp;lsquo;RemoteServerName&amp;rsquo;, &amp;lsquo;collation compatible&amp;rsquo;, true&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New';"&gt;&lt;span style="font-size: small;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h2 style="margin: 10pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #4f81bd; font-size: medium;"&gt;Downsides and potential pitfalls&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;This solution is not perfect and at times it can be a struggle.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Most of the difficulties have been mentioned in &lt;/span&gt;&lt;a href="http://blogs.msdn.com/b/sqlcat/archive/2007/06/20/distributed-partitioned-views-federated-databases-lessons-learned.aspx"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;this blog&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;, but the two main ones are summarized here for convenience.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The blog contains the solutions/workarounds to these problems so it is worth reading.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;1.&lt;/span&gt;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Optimizer sometimes ignores your WHERE clause and sends the query to every server, every database.&amp;nbsp; The solution is to put constraints on your SQL Azure tables so the optimizer can determine which shard to touch and which to eliminate.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;2.&lt;/span&gt;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Non-remotable query where all data comes back to the local server without being filtered by the remote database.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h2 style="margin: 10pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #4f81bd; font-size: medium;"&gt;What if one database is not available? &lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;If the view needs to touch all the databases and one is not available, the query will fail.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;If the view has determined that it can do partition elimination and does not need the unavailable database, then the query will succeed.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The only exception to this is the first time a DPV is executed after a restart of your local SQL Server, it needs to touch every destination database to get the constraints and store them locally (in memory).&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Remember to turn on lazy schema validation so that every query after the first one does not get sent to each database just to check the schema.&lt;/span&gt;&lt;/p&gt;
&lt;h2 style="margin: 10pt 0in 0pt;"&gt;&lt;span style="font-size: medium;"&gt;&lt;span style="color: #4f81bd;"&gt;&lt;span style="font-family: Cambria;"&gt;Leveraging Constraints for Partition Elimination &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;How does SQL Server know which databases to touch? To test this scenario, create the different databases on SQL Azure so that your main table contains data from each month of a certain year.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Perhaps create the databases called AppDB2010_01 and AppDB2010_02 to make it easier for you to remember what the database contains.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;These names are meaningless and have no bearing on what you actually store in the database.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Create a table, perhaps call it FACT and make sure it has a DATE or DATETIME (or any other date oriented data type).&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;The key to making this solution work efficiently is to create a constraint on this DATE field so that SQL Server knows it only contains data within a certain range.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In this example, it will only contain data for a certain month of a certain year; i.e. January 2010.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This constraint is what gets cached on your local server after the first use of the DPV so that SQL Server knows which tables to touch during a query.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Now test to confirm using a query such as:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;SELECT * FROM dpv_Test WHERE &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;datefield = &amp;lsquo;2010-01-15&amp;rsquo;.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;How do you know a query did not touch a certain database?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Since SQL Profiler does not work in SQL Azure, the only way to know which queries ran on a certain server is to use certain DPVs to see what plans have been generated.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The following query will return a list of recently generated statistics and plans for a server:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: gray;"&gt;*&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_exec_query_stats&lt;/span&gt; qs &lt;span style="color: gray;"&gt;CROSS&lt;/span&gt; &lt;span style="color: gray;"&gt;APPLY&lt;/span&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_exec_query_plan&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;qs&lt;span style="color: gray;"&gt;.&lt;/span&gt;plan_handle&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;ORDER&lt;/span&gt; &lt;span style="color: blue;"&gt;BY&lt;/span&gt; last_execution_time &lt;span style="color: blue;"&gt;DESC&lt;/span&gt;&lt;span style="color: gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h2 style="margin: 10pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #4f81bd; font-size: medium;"&gt;Summary&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;It is possible to use a local SQL Server to simplify access to a multiple SQL Azure database.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The performance may be better than individual links from a front end tool when partition elimination is used.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h2 style="margin: 10pt 0in 0pt;"&gt;&lt;span style="font-family: Cambria; color: #4f81bd; font-size: medium;"&gt;Appendix: SQL Azure Billing Summary&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Thanks to Lubor Kollar for creating these queries.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: gray;"&gt;*&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;Database_Usage&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: gray;"&gt;*&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;Bandwidth_Usage&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SKU&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: fuchsia;"&gt;SUM&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;CASE&lt;/span&gt; &lt;span style="color: blue;"&gt;WHEN&lt;/span&gt; USAGE&lt;span style="color: gray;"&gt;.&lt;/span&gt;SKU &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;'Web'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;THEN &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;Quantity &lt;span style="color: gray;"&gt;*&lt;/span&gt; 9.99&lt;span style="color: gray;"&gt;/&lt;/span&gt;31&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt; USAGE&lt;span style="color: gray;"&gt;.&lt;/span&gt;SKU &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;'Business'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;THEN &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;Quantity &lt;span style="color: gray;"&gt;*&lt;/span&gt; 99.99&lt;span style="color: gray;"&gt;/&lt;/span&gt;31&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;END&lt;/span&gt; &lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; CostInDollars&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;FROM&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;Database_Usage USAGE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;WHERE&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: fuchsia;"&gt;datepart&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;yy&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: blue;"&gt;TIME&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;datepart&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;yy&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;GetUTCDate&lt;/span&gt;&lt;span style="color: gray;"&gt;())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-no-proof: yes;"&gt;AND&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: fuchsia;"&gt;datepart&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;mm&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: blue;"&gt;TIME&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;datepart&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;mm&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;GetUTCDate&lt;/span&gt;&lt;span style="color: gray;"&gt;())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;GROUP&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;BY&lt;/span&gt; &lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SKU&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;USAGE&lt;span style="color: gray;"&gt;.&lt;/span&gt;Time_Period&lt;span style="color: gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;USAGE&lt;span style="color: gray;"&gt;.&lt;/span&gt;Direction&lt;span style="color: gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;CASE&lt;/span&gt; &lt;span style="color: blue;"&gt;WHEN&lt;/span&gt; USAGE&lt;span style="color: gray;"&gt;.&lt;/span&gt;Direction &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;'Egress'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt; 0.15 &lt;span style="color: gray;"&gt;*&lt;/span&gt; USAGE&lt;span style="color: gray;"&gt;.&lt;/span&gt;BandwidthInKB&lt;span style="color: gray;"&gt;/(&lt;/span&gt;1024&lt;span style="color: gray;"&gt;*&lt;/span&gt;1024&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt; USAGE&lt;span style="color: gray;"&gt;.&lt;/span&gt;DIRECTION &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;'Ingress'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt; 0.10 &lt;span style="color: gray;"&gt;*&lt;/span&gt; USAGE&lt;span style="color: gray;"&gt;.&lt;/span&gt;BandwidthInKB&lt;span style="color: gray;"&gt;/(&lt;/span&gt;1024&lt;span style="color: gray;"&gt;*&lt;/span&gt;1024&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;END&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; CostInDollars&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-no-proof: yes;"&gt;FROM &lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-no-proof: yes;"&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Time_Period&lt;span style="color: gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Direction&lt;span style="color: gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: fuchsia;"&gt;SUM&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;Quantity&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; BandwidthInKB&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;FROM&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;Bandwidth_Usage&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;WHERE&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: fuchsia;"&gt;datepart&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;yy&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: blue;"&gt;TIME&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;datepart&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;yy&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;GetUTCDate&lt;/span&gt;&lt;span style="color: gray;"&gt;())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: gray;"&gt;AND&lt;/span&gt;&lt;span style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: fuchsia;"&gt;datepart&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;mm&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: blue;"&gt;TIME&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;datepart&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;mm&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;GetUTCDate&lt;/span&gt;&lt;span style="color: gray;"&gt;())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: gray;"&gt;AND&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;class &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;'External'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;GROUP&lt;/span&gt; &lt;span style="color: blue;"&gt;BY&lt;/span&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Time_Period&lt;span style="color: gray;"&gt;,&lt;/span&gt; Direction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-no-proof: yes;"&gt;)&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; USAGE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10137914" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Performance+and+Scalability/">Performance and Scalability</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Development+_2600_amp_3B00_+Programming/">Development &amp;amp; Programming</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Query+performance/">Query performance</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server+Best+Practices/">SQL Server Best Practices</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Server/">SQL Server</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/SQL+Azure/">SQL Azure</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Cloud/">Cloud</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/MySQL+SQL+Azure/">MySQL SQL Azure</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Access+SQL+Server/">Access SQL Server</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Linked+Servers/">Linked Servers</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Partitioned+Views/">Partitioned Views</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/sharding/">sharding</category></item><item><title>Comparing Different Results with RCSI &amp; Read Committed</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/03/03/comparing-different-results-with-rcsi-amp-read-committed.aspx</link><pubDate>Thu, 03 Mar 2011 21:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10136627</guid><dc:creator>Kun Cheng</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10136627</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/03/03/comparing-different-results-with-rcsi-amp-read-committed.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;&lt;span style="font-family: 'Calibri','sans-serif'; color: black; font-size: 11pt; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"&gt;Author:&amp;nbsp;Kun Cheng&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="font-family: 'Calibri','sans-serif'; color: black; font-size: 11pt; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: 'Calibri','sans-serif'; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"&gt;Reviewers: Sunil Agarwal, Steve Howard, Shaun Tinline-Jones, Prem Mehra, Sanjay Mishra, Michael Thomassy, Mike Ruthruff, Howard Yin, Jimmy May &lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: 'Calibri','sans-serif'; color: black; font-size: 11pt; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;During a recent ISV partner engagement, we decided to enable RCSI (Read Committed Snapshot Isolation) on a SQL Server 2008 R2 instance with the objective of minimizing blocking. As expected, we did not encounter any significant blocking. However, we did find different behavior when we compared the results using RCSI to those we got using SQL Server&amp;rsquo;s default RC (Read Committed) isolation level. In a nutshell, blocking in the SQL Server database may have different data results when a query reads and changes multiple tables at the same time using RCSI compared to using RC isolation level.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The remainder of this blog describes this behavior in greater detail, along with a basic code for illustrative purposes: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h1 style="margin: 24pt 0in 0pt;"&gt;&lt;span style="color: #365f91;"&gt;&lt;span style="font-family: Cambria;"&gt;Let&amp;rsquo;s start with the default RC isolation level:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 10pt;"&gt;-- set up test database and tables t1 and t2&lt;span class="msoIns"&gt;&lt;ins cite="mailto:Shaun%20Tinline-Jones" datetime="2011-02-23T09:49"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/ins&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;CREATE&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;DATABASE&lt;/span&gt; &lt;span style="color: teal;"&gt;testRCSI&lt;/span&gt;&lt;span style="color: gray;"&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;GO&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;USE&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;testRCSI&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;GO&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;CREATE&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;TABLE&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; &lt;span style="color: gray;"&gt;NOT&lt;/span&gt; &lt;span style="color: gray;"&gt;NULL&lt;/span&gt; &lt;span style="color: blue;"&gt;PRIMARY&lt;/span&gt; &lt;span style="color: blue;"&gt;KEY&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: teal;"&gt;bid&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; &lt;span style="color: gray;"&gt;NOT&lt;/span&gt; &lt;span style="color: gray;"&gt;NULL)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;GO&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;CREATE&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;TABLE&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t2&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; &lt;span style="color: gray;"&gt;NOT&lt;/span&gt; &lt;span style="color: gray;"&gt;NULL&lt;/span&gt; &lt;span style="color: blue;"&gt;PRIMARY&lt;/span&gt; &lt;span style="color: blue;"&gt;KEY&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;GO&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;INSERT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;bid&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;VALUES&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;1&lt;span style="color: gray;"&gt;,&lt;/span&gt;1&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;INSERT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t2&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;VALUES&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;1&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="0" class="MsoNormalTable" style="width: 655px; border-collapse: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 0in 0in 0in;"&gt;
&lt;tbody&gt;
&lt;tr style="page-break-inside: avoid; height: 24.65pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes;"&gt;
&lt;td width="55" valign="top" style="padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 41.4pt; padding-right: 5.4pt; height: 24.65pt; padding-top: 0in; border: black 1pt solid;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: SimSun; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;Time&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="324" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 243pt; padding-right: 5.4pt; height: 24.65pt; border-top: black 1pt solid; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: SimSun; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;Connection 1&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="276" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 207pt; padding-right: 5.4pt; height: 24.65pt; border-top: black 1pt solid; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: SimSun; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;Connection 2&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 1;"&gt;
&lt;td width="55" valign="top" style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 41.4pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;T1&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="324" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 243pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;BEGIN&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;TRAN&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;-- with RC isolation level&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;INSERT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;bid&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;VALUES&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;2&lt;span style="color: gray;"&gt;,&lt;/span&gt;2&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;INSERT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: teal;"&gt;t2&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;VALUES&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;2&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="276" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 207pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 2;"&gt;
&lt;td width="55" valign="top" style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 41.4pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;T2&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="324" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 243pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="276" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 207pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;DELETE&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt; &lt;span style="color: gray;"&gt;JOIN&lt;/span&gt; &lt;span style="color: teal;"&gt;t2&lt;/span&gt; &lt;span style="color: blue;"&gt;ON &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;bid&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: teal;"&gt;t2&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 3;"&gt;
&lt;td width="55" valign="top" style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 41.4pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;T3&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="324" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 243pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="276" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 207pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="mso-fareast-font-family: SimSun; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;Blocked&lt;/span&gt;&lt;span style="mso-fareast-font-family: 'MS PGothic'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 4;"&gt;
&lt;td width="55" valign="top" style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 41.4pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;T4&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="324" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 243pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;COMMIT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="276" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 207pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 5; mso-yfti-lastrow: yes;"&gt;
&lt;td width="55" valign="top" style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 41.4pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;T5&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="324" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 243pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="276" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 207pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="mso-fareast-font-family: SimSun; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;Two rows deleted &lt;/span&gt;&lt;/b&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="mso-fareast-font-family: 'MS PGothic'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-fareast-language: ZH-CN;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-fareast-language: ZH-CN;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The results were:&lt;span class="msoIns"&gt;&lt;ins cite="mailto:Shaun%20Tinline-Jones" datetime="2011-02-23T09:50"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/ins&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;id&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;(none)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;id&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h1 style="margin: 24pt 0in 0pt;"&gt;&lt;span style="mso-no-proof: yes; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;span style="color: #365f91;"&gt;&lt;span style="font-family: Cambria;"&gt;After we enabled RCSI, the result were very different:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;-- Set isolation level as read_committed_snapshot and reset tables&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;ALTER&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;DATABASE&lt;/span&gt; &lt;span style="color: teal;"&gt;testRCSI&lt;/span&gt; &lt;span style="color: blue;"&gt;SET&lt;/span&gt; &lt;span style="color: blue;"&gt;READ_COMMITTED_SNAPSHOT&lt;/span&gt; &lt;span style="color: blue;"&gt;ON&lt;/span&gt;&lt;span style="color: gray;"&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;GO&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;USE&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;testRCSI&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;GO&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;TRUNCATE TABLE t1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;TRUNCATE TABLE t2&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;GO&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;INSERT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;bid&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;VALUES&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;1&lt;span style="color: gray;"&gt;,&lt;/span&gt;1&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;INSERT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: teal;"&gt;t2&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;VALUES&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;1&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="0" class="MsoNormalTable" style="width: 655px; border-collapse: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 0in 0in 0in;"&gt;
&lt;tbody&gt;
&lt;tr style="page-break-inside: avoid; height: 24.65pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes;"&gt;
&lt;td width="61" valign="top" style="padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 45.9pt; padding-right: 5.4pt; height: 24.65pt; padding-top: 0in; border: black 1pt solid;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: SimSun; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;Time&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="305" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 228.45pt; padding-right: 5.4pt; height: 24.65pt; border-top: black 1pt solid; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: SimSun; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;Connection 1&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="289" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 217.05pt; padding-right: 5.4pt; height: 24.65pt; border-top: black 1pt solid; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: SimSun; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;Connection 2&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 1;"&gt;
&lt;td width="61" valign="top" style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 45.9pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;T1&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="305" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 228.45pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;BEGIN&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;TRAN&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;-- with RCSI level&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;INSERT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: teal;"&gt;bid&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;VALUES&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;2&lt;span style="color: gray;"&gt;,&lt;/span&gt;2&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 10pt;"&gt;INSERT&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: teal;"&gt;t2&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;VALUES&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;2&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="289" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 217.05pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 2;"&gt;
&lt;td width="61" valign="top" style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 45.9pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;T2&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="305" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 228.45pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="289" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 217.05pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;DELETE&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt; &lt;span style="color: gray;"&gt;JOIN&lt;/span&gt; &lt;span style="color: teal;"&gt;t2&lt;/span&gt; &lt;span style="color: blue;"&gt;ON &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;bid&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: teal;"&gt;t2&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 3;"&gt;
&lt;td width="61" valign="top" style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 45.9pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;T3&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="305" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 228.45pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="289" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 217.05pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="mso-fareast-font-family: SimSun; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;Blocked&lt;/span&gt;&lt;span style="mso-fareast-font-family: 'MS PGothic'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 4;"&gt;
&lt;td width="61" valign="top" style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 45.9pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;T4&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="305" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 228.45pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 10pt;"&gt;COMMIT&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="289" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 217.05pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 5; mso-yfti-lastrow: yes;"&gt;
&lt;td width="61" valign="top" style="border-bottom: black 1pt solid; border-left: black 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 45.9pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal" align="center"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b&gt;T5&lt;/b&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="305" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 228.45pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'MS PGothic';"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="289" valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 217.05pt; padding-right: 5.4pt; border-top: #f0f0f0; border-right: black 1pt solid; padding-top: 0in;"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="mso-fareast-font-family: SimSun; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;One row deleted &lt;/span&gt;&lt;/b&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="mso-fareast-font-family: 'MS PGothic'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-fareast-language: ZH-CN;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-fareast-language: ZH-CN;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The results were:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;id&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;id&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;How do we explain the difference in the results? At time T3, when DELETE was blocked by INSERT, sys.dm_tran_locks showed that the DELETE was waiting for a key lock on the newly added row 2&lt;b style="mso-bidi-font-weight: normal;"&gt;. &lt;/b&gt;Once the INSERT was committed, the DELETE was unblocked on row 2. So why wasn&amp;rsquo;t the row deleted?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="line-height: 115%; font-family: 'Cambria','serif'; color: #1f497d; font-size: 14pt; mso-no-proof: yes; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-themecolor: text2;"&gt;Explaining Results when RCSI Is Enabled&lt;/span&gt;&lt;/b&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="line-height: 115%; font-family: 'Cambria','serif'; color: #1f497d; font-size: 14pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin; mso-themecolor: text2;"&gt;&lt;span class="msoDel"&gt;&lt;del cite="mailto:Shaun%20Tinline-Jones" datetime="2011-02-23T10:59"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/del&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="mso-no-proof: yes; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;To understand this behavior, it is important to note that even when RCSI is enabled on the entire database, &lt;/span&gt;the snapshot effect is only applicable to the read operations on a table. The snapshot effect does not apply to DML (data manipulation language) operations. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In the query above, the DELETE operation occurred on table t1, so SQL Server took a blocking lock. Table t2, however, was accessed by the read part of the DELETE query, so a snapshot of the data in t2 was obtained and it did not block. It retrieved one row (value 1) because it was the only row committed at the beginning of the transaction. Once the DELETE operation was unblocked, it found only one qualifying row based on the join and it deleted that row.&lt;span style="mso-no-proof: yes; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;So how do you resolve the differences between the two tables and achieve the same result as achieved using the default RC isolation level? You can use &lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;READCOMMITTEDLOCK &lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: text1;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;query hint to make the read operation (against table t2) comply with the rules for the RC isolation level. In fact the query hint would make queries behave the same as under RC isolation level. This is exactly what my ISV partner wanted for the scenario and implemented in their application. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;DELETE&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt; &lt;span style="color: gray;"&gt;JOIN&lt;/span&gt; &lt;span style="color: teal;"&gt;t2&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;READCOMMITTEDLOCK&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;ON &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;bid&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: teal;"&gt;t2&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;-- this would delete both rows from t1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: gray; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-fareast-language: ZH-CN;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Results:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;id&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;(none)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;id&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: gray; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Alternately, if you just want to obtain the same results when RSCI was enabled, you can use snapshot transaction isolation for the DELETE query:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;ALTER&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;DATABASE&lt;/span&gt; &lt;span style="color: teal;"&gt;testRCSI&lt;/span&gt; &lt;span style="color: blue;"&gt;SET&lt;/span&gt; &lt;span style="color: blue;"&gt;ALLOW_SNAPSHOT_ISOLATION&lt;/span&gt; &lt;span style="color: blue;"&gt;ON&lt;/span&gt;&lt;span style="color: gray;"&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;SET&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;transaction&lt;/span&gt; &lt;span style="color: blue;"&gt;ISOLATION&lt;/span&gt; &lt;span style="color: blue;"&gt;LEVEL&lt;/span&gt; &lt;span style="color: blue;"&gt;SNAPSHOT&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;BEGIN&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;TRAN&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;DELETE&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;t1&lt;/span&gt; &lt;span style="color: gray;"&gt;JOIN&lt;/span&gt; &lt;span style="color: teal;"&gt;t2&lt;/span&gt; &lt;span style="color: blue;"&gt;ON &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: teal;"&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;bid&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: teal;"&gt;t2&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;id&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 10pt;"&gt;-- this is not blocked by insert &lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;COMMIT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraph"&gt;&lt;span class="keywordhighlight1"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-fareast-language: ZH-CN;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Results:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;id&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt;"&gt; &lt;span style="color: teal;"&gt;id&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: teal;"&gt;dbo&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: teal;"&gt;t2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 10pt; mso-fareast-language: ZH-CN;"&gt;2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In summary, blocking in the SQL Server database might have different results when a query reads and changes multiple tables at the same time using RCSI than it does when using the default RC isolation levels. However, you can take the actions this post describes to get the results you expect.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;span style="font-size: small;"&gt;For more information about row versioning-based isolation levels, please see&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri;"&gt; &amp;ldquo;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://technet.microsoft.com/en-us/library/ms189050.aspx"&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri;"&gt;&lt;span style="font-family: Calibri; color: #0000ff;"&gt;Understanding Row Versioning-Based Isolation Levels&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="line-height: 115%; font-size: 10.5pt; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri;"&gt;&lt;span style="font-family: Calibri;"&gt;&amp;rdquo; (&lt;/span&gt;&lt;/span&gt;&lt;a href="http://technet.microsoft.com/en-us/library/ms189050.aspx"&gt;&lt;span style="font-family: Calibri; color: #0000ff; font-size: small;"&gt;http://technet.microsoft.com/en-us/library/ms189050.aspx&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst"&gt;&lt;span class="keywordhighlight1"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&lt;o:p&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle"&gt;&lt;span class="keywordhighlight1"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&lt;strong&gt;Reference:&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast"&gt;&lt;span class="keywordhighlight1"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&lt;strong&gt;Recommend reading of Sunil&amp;rsquo;s series of concurrency blogs:&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h4 style="margin: 10pt 0in 0pt;"&gt;&lt;em&gt;&lt;span class="keywordhighlight1"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: black; font-size: 10pt; font-weight: normal;"&gt;&amp;ldquo;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: #4f81bd;"&gt;&lt;span style="font-family: Cambria;"&gt;Concurrency Series: My application was running fine yesterday buy why is it blocking today?&amp;rdquo;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/h4&gt;
&lt;p class="MsoListParagraph"&gt;&lt;span class="keywordhighlight1"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&lt;a href="http://sqlcat.com/msdnmirror/archive/2011/02/20/concurrency-series-my-application-was-running-fine-yesterday-buy-why-is-it-blocking-today.aspx"&gt;&lt;span style="font-weight: normal;"&gt;http://sqlcat.com/msdnmirror/archive/2011/02/20/concurrency-series-my-application-was-running-fine-yesterday-buy-why-is-it-blocking-today.aspx&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h4 style="margin: 10pt 0in 0pt;"&gt;&lt;em&gt;&lt;span class="keywordhighlight1"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: black; font-size: 10pt; font-weight: normal;"&gt;&amp;ldquo;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #4f81bd;"&gt;&lt;span style="font-family: Cambria;"&gt;&lt;span style="font-size: small;"&gt;Concurrency Series: Minimizing blocking between updaters&amp;rdquo;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/h4&gt;
&lt;p class="MsoNormal"&gt;&lt;a href="http://sqlcat.com/msdnmirror/archive/2011/02/20/concurrency-series-minimizing-blocking-between-updaters.aspx"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;http://sqlcat.com/msdnmirror/archive/2011/02/20/concurrency-series-minimizing-blocking-between-updaters.aspx&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h4 style="margin: 10pt 0in 0pt;"&gt;&lt;em&gt;&lt;span style="color: #4f81bd;"&gt;&lt;span style="font-family: Cambria;"&gt;&lt;span style="font-size: small;"&gt;&amp;ldquo;Concurrency Series: Why do I get block when no one has locked the row(s) being queried?&amp;rdquo;&lt;span style="line-height: 115%; font-size: 12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/h4&gt;
&lt;p class="MsoNormal"&gt;&lt;a href="http://sqlcat.com/msdnmirror/archive/2011/02/20/concurrency-series-why-do-i-get-block-when-no-one-has-locked-the-row-s-being-queried.aspx"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;http://sqlcat.com/msdnmirror/archive/2011/02/20/concurrency-series-why-do-i-get-block-when-no-one-has-locked-the-row-s-being-queried.aspx&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h4 style="margin: 10pt 0in 0pt;"&gt;&lt;em&gt;&lt;span style="color: #4f81bd;"&gt;&lt;span style="font-family: Cambria;"&gt;&lt;span style="font-size: small;"&gt;&amp;ldquo;Concurrency Series: Why do I get blocking when I use Read Uncommitted isolation level or use NOLOCK hint?&amp;rdquo;&lt;span style="line-height: 115%; font-size: 12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/h4&gt;
&lt;p class="MsoNormal"&gt;&lt;a href="http://sqlcat.com/msdnmirror/archive/2011/02/20/concurrency-series-why-do-i-get-blocking-when-i-use-read-uncommitted-isolation-level-or-use-nolock-hint.aspx"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;http://sqlcat.com/msdnmirror/archive/2011/02/20/concurrency-series-why-do-i-get-blocking-when-i-use-read-uncommitted-isolation-level-or-use-nolock-hint.aspx&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h4 style="margin: 10pt 0in 0pt;"&gt;&lt;em&gt;&lt;span style="color: #4f81bd;"&gt;&lt;span style="font-family: Cambria;"&gt;&lt;span style="font-size: small;"&gt;&amp;ldquo;Concurrency Series: Basics of Transaction Isolation Levels&amp;rdquo;&lt;span style="line-height: 115%; font-size: 12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/h4&gt;
&lt;p class="MsoNormal"&gt;&lt;a href="http://sqlcat.com/msdnmirror/archive/2011/02/20/concurrency-series-basics-of-transaction-isolation-levels.aspx"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;http://sqlcat.com/msdnmirror/archive/2011/02/20/concurrency-series-basics-of-transaction-isolation-levels.aspx&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10136627" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/sql/">sql</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/RCSI/">RCSI</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Snapshot+Isolation/">Snapshot Isolation</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Blocking/">Blocking</category></item><item><title>Why the obsession with random I/O within the context of SSAS?</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/03/01/why-the-obsession-with-random-i-o-within-the-context-of-ssas.aspx</link><pubDate>Tue, 01 Mar 2011 16:15:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10135579</guid><dc:creator>Denny Lee [MSFT]</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10135579</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/03/01/why-the-obsession-with-random-i-o-within-the-context-of-ssas.aspx#comments</comments><description>&lt;p&gt;by Denny Lee&lt;/p&gt;
&lt;p&gt;As many of you know from the various blogs, whitepapers, and conferences from SQLCAT, there is a big obsession or compulsion toward I/O by various members of SQLCAT. If you&amp;rsquo;re not already familiar with this topic, definitely reference &lt;strong&gt;Mike Ruthruff&lt;/strong&gt;&amp;rsquo;s whitepaper &lt;a href="http://sqlcat.com/whitepapers/archive/2007/11/21/predeployment-i-o-best-practices.aspx"&gt;&lt;span style="color: #265e15;"&gt;Predeployment I/O Best Practices&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But as could be seen from the SSAS Maestros session in Redmond this week (for more information, check out &lt;a href="http://sqlcat.com/msdnmirror/archive/2011/01/30/what-is-the-ssas-maestros.aspx"&gt;&lt;span style="color: #265e15;"&gt;What is the SSAS Maestros&lt;/span&gt;&lt;/a&gt;?), there is even an obsession for IOps even within the context of Analysis Services as noted in the papers below&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://sqlcat.com/whitepapers/archive/2010/06/08/scale-out-querying-for-analysis-services-with-read-only-databases.aspx"&gt;&lt;span style="color: #265e15;"&gt;Scale-Out Querying for Analysis Services with Read-Only Databases&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://sqlcat.com/technicalnotes/archive/2010/09/20/analysis-services-distinct-count-optimization-using-solid-state-devices.aspx"&gt;&lt;span style="color: #265e15;"&gt;Analysis Services Distinct Count Optimization Using Solid State Devices&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://sqlcat.com/whitepapers/archive/2008/04/17/analysis-services-distinct-count-optimization.aspx"&gt;&lt;span style="color: #265e15;"&gt;Analysis Services Distinct Count Optimization&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://sqlcat.com/whitepapers/archive/2009/09/19/accelerating-microsoft-adcenter-with-microsoft-sql-server-2008-analysis-services.aspx"&gt;&lt;span style="color: #265e15;"&gt;Accelerating Microsoft adCenter with Microsoft SQL Server 2008 Analysis Services&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://sqlcat.com/whitepapers/archive/2009/02/15/the-analysis-services-2008-performance-guide.aspx"&gt;&lt;span style="color: #265e15;"&gt;The Analysis Services 2008 Performance Guide&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;So why is the obsession?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As noted in the SSAS Maestros course, if you think I&amp;rsquo;m bad, ping my counterpart &lt;strong&gt;Thomas Kejser&lt;/strong&gt; who is even more obsessed and all-knowing about IOps. The reason for this focus is because for many queries within Analysis Services (especially for enterprise scale cubes), there are a lot of threads that hit the storage engine. This means that the threads will be hitting disk &amp;ndash; i.e. the disk I/O subsystem. And even if the each individual thread causes only sequential I/O, the cumulative effect of all of those threads is random I/O. And as noted in the below graphic - which is from &lt;strong&gt;Michael Anderson&lt;/strong&gt;&amp;rsquo;s excellent &lt;a href="http://sqlvelocity.typepad.com/blog/2011/02/scalable-shared-database-part-5.html"&gt;&lt;span style="color: #265e15;"&gt;Scalable Shared Database Part 5&lt;/span&gt;&lt;/a&gt; post &amp;ndash; both the IOps and MBps is substantially slower when the system is random instead of sequential.&lt;/p&gt;
&lt;p&gt;&lt;img height="259" width="376" src="http://sqlvelocity.typepad.com/.a/6a0134854dd1e3970c0148c83cb654970c-pi" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;So what can we do about it?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As noted by the our posts &lt;a href="http://sqlcat.com/technicalnotes/archive/2010/09/20/analysis-services-distinct-count-optimization-using-solid-state-devices.aspx"&gt;&lt;span style="color: #265e15;"&gt;Analysis Services Distinct Count Optimization Using Solid State Devices&lt;/span&gt;&lt;/a&gt; as well as the paper: &lt;a href="http://www.emc.com/collateral/hardware/white-papers/h8129-performance-scaling-sql-wp.pdf"&gt;&lt;span style="color: #265e15;"&gt;REAL Practices: Performance Scaling Microsoft SQL Server 2008 Analysis Services at Microsoft adCenter&lt;/span&gt;&lt;/a&gt;, the solution is to utilize NAND devices which have superior random IOps performance. &lt;/p&gt;
&lt;p&gt;Note, you can still get great random IOps performance using regular spinning media provided you have enough spindles for your LUNs and you stripe and/or short-stroke the disks. &lt;/p&gt;
&lt;p&gt;Or&amp;hellip;you can make sure you buddy up with your friendly systems engineer whom can take care of this for you!&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10135579" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/analysis+services/">analysis services</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/BI/">BI</category></item><item><title>Concurrency Series: My application was running fine yesterday but why is it blocking today? </title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-my-application-was-running-fine-yesterday-buy-why-is-it-blocking-today.aspx</link><pubDate>Sun, 20 Feb 2011 22:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10131969</guid><dc:creator>Sunil Agarwal</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10131969</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-my-application-was-running-fine-yesterday-buy-why-is-it-blocking-today.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;strong&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt;"&gt;Author: Sunil Agarwal&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt;"&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: 'Arial','sans-serif';"&gt;Reviewers: Kun Cheng, Chuck Heinzelman, Shaun Tinline-Jones, Sanjay Mishra, And Kevin Liu&lt;/span&gt;&lt;/strong&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Have you ever encountered a situation where a query was running fine yesterday but today it is running a lot slower? I am sure most of us have seen a situation like that which can be quite frustrating. While there can be many reasons but there are two common cases as described below:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst"&gt;&lt;span style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font-size: small;"&gt;&amp;middot;&lt;/span&gt;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;First is that the query plan might have changed due to stale statistics, or missing indexes (accidental drop of an index) or by passing an uncommon parameter value leading to an inefficient query plan for other parameter values. &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast"&gt;&lt;span style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font-size: small;"&gt;&amp;middot;&lt;/span&gt;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Second is due to blocking. In this blog, I will focus on the blocking that is caused specifically by lock escalation. &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Before we proceed further, I would like point out that the best way to troubleshoot performance problems is to have a baseline of your workload when it was running with acceptable performance. You can then use the baseline compare it with current situation to get clues of what could be going wrong. I will recommend that you read the white paper to get an idea about general methodology &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd672789(SQL.100).aspx"&gt;&lt;span style="font-family: Calibri; color: #0000ff; font-size: small;"&gt;http://msdn.microsoft.com/en-us/library/dd672789(SQL.100).aspx&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Now, let us go back to the problem.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In SQL Server, a lock can be taken at a row, page, or table level but there is a trade-off. If the lock is taken at a lower granularity say at ROW level, it will lead to more concurrency at the expense of higher number of locks. Similarly, if the lock is taken at a higher granularity say at TABLE level, it will lead to lower concurrency but at much reduced overhead of locks. To take an extreme example, if you have a table with 10 million rows and you need to read 10% of the rows at &amp;lsquo;repeatable read&amp;rsquo; isolation level, the SQL Server, assuming it chose ROW locking granularity, will need to acquire 1 million locks, hold them in memory (approx. 100 MB storage) and then release 1 million locks at the end of the transaction. This is a significant overhead compared to 1 lock to be taken at table level with TABLE locking granularity. SQL Server uses an internal heuristic to choose the locking granularity when executing a SQL statement. You can override this locking granularity using &lt;i style="mso-bidi-font-style: normal;"&gt;Alter Index&lt;/i&gt; statement to control &lt;i style="mso-bidi-font-style: normal;"&gt;(ALLOW_PAGE_LOCKS or ALLOW_ROW_LOCKS).&lt;/i&gt; Additionally, SQL Server uses the lock escalation mechanism to promote the lock from lower granularity to TABLE level using an internal threshold. Please refer to &lt;/span&gt;&lt;a href="http://blogs.msdn.com/b/sqlserverstorageengine/archive/2006/05/17/lock-escalation.aspx"&gt;&lt;span style="font-family: Calibri; color: #0000ff; font-size: small;"&gt;http://blogs.msdn.com/b/sqlserverstorageengine/archive/2006/05/17/lock-escalation.aspx&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt; for details. Starting with SQL Server 2008, you can also optionally disable lock escalation at TABLE level. &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Let us look at some example to understand lock escalation behavior.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- create the table&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;create&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;table&lt;/span&gt; t_escalation&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;c1 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; c2 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;go&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- create a clustered index.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;create&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;clustered&lt;/span&gt; &lt;span style="color: blue;"&gt;index&lt;/span&gt; ci_t_escalation &lt;span style="color: blue;"&gt;on&lt;/span&gt; t_escalation&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;c1&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;go&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- insert 10000 rows into the table. Note, there will NOT be any lock -- escalation in this case even though we are inserting 10000 rows as -- part of single transaction. The lock escalation threshold in SQL &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- Server is defined at a statement level rather than at transaction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- level&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;begin&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;tran&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;declare&lt;/span&gt; @i &lt;span style="color: blue;"&gt;int&lt;/span&gt; &lt;span style="color: gray;"&gt;=&lt;/span&gt; 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;while &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;@i &lt;span style="color: gray;"&gt;&amp;lt;&lt;/span&gt; 10000&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;insert&lt;/span&gt; &lt;span style="color: blue;"&gt;into&lt;/span&gt; t_escalation &lt;span style="color: blue;"&gt;values &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;@i&lt;span style="color: gray;"&gt;,&lt;/span&gt; @i&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 2;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;set&lt;/span&gt; @i &lt;span style="color: gray;"&gt;=&lt;/span&gt; @i &lt;span style="color: gray;"&gt;+&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;end&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;commit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;The table &lt;i style="mso-bidi-font-style: normal;"&gt;t_escalation&lt;/i&gt; has 10000 rows. Let us update all rows in a single UPDATE statement. In this case, we will expect the lock escalation to occur as we are modifying &amp;gt; 5000 rows and there are not a concurrent transaction accessing the table &lt;i style="mso-bidi-font-style: normal;"&gt;t_escalation&lt;/i&gt; to prevent it.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- Update all 10000 rows&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;declare&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @escalation_counter_before_test &lt;span style="color: blue;"&gt;bigint&lt;/span&gt;&lt;span style="color: gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @escalation_counter_before_test&lt;span style="color: gray;"&gt;=&lt;/span&gt;cntr_value &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;from&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_os_performance_counters&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;where&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;counter_name &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;'Table Lock Escalations/sec'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: red; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;begin&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;tran&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;update&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; t_escalation &lt;span style="color: blue;"&gt;set&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;+&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;declare&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @escalation_counter_after_test &lt;span style="color: blue;"&gt;bigint&lt;/span&gt;&lt;span style="color: gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @escalation_counter_after_test&lt;span style="color: gray;"&gt;=&lt;/span&gt;cntr_value &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;from&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_os_performance_counters&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;where&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;counter_name &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;'Table Lock Escalations/sec'&lt;/span&gt;&lt;span style="color: gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- check to see if the lock escalation has occured&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;print&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: red;"&gt;'lock escalation count '&lt;/span&gt; &lt;span style="color: gray;"&gt;+&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: fuchsia;"&gt;convert&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt; &lt;span style="color: blue;"&gt;varchar&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;100&lt;span style="color: gray;"&gt;),&lt;/span&gt; @escalation_counter_after_test&lt;span style="color: gray;"&gt;- &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;@escalation_counter_before_test&lt;span style="color: gray;"&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- commit the transaction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;commit&lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 14pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Here is the output of running the batch above. As expected, we got the lock escalation.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;(10000 row(s) affected)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;lock escalation count 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Now, let us consider a variation of this example where instead of updating all the rows in the table, we only update the rows that qualify the predicate &lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;(&lt;span style="mso-no-proof: yes;"&gt;C1 &lt;span style="color: gray;"&gt;&amp;lt;&lt;/span&gt; 4000).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; font-size: 14pt; mso-no-proof: yes;"&gt; &lt;/span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Since 4000 rows is less than the threshold of 5000 rows, there will be no lock escalation.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- update only 4000 rows. In this case, the SQL Server&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- chose ROW locking granularity.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;begin&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;tran&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;update&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; t_escalation &lt;span style="color: blue;"&gt;set&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;+&lt;/span&gt; 1 &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;&amp;lt;&lt;/span&gt; 4000&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Concurrently, we run the following query in a different session. &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- Session-2: Select a row that was not a target of&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- update in session-1. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: gray;"&gt;*&lt;/span&gt; &lt;span style="color: blue;"&gt;from&lt;/span&gt; t_escalation &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 5000&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;You will note that this SELECT runs without blocking because the query plan for this query shows it is using the index scan as follows &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-50-01/8105.image_2D00_7.jpg" border="0" /&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;We now commit the transaction in session-1 &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- commit the transaction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;Commit&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;a name="_GoBack"&gt;&lt;/a&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Next step is to insert another 3000 rows in between the range (1 to 4000) as follows&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;declare&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @i &lt;span style="color: blue;"&gt;int&lt;/span&gt; &lt;span style="color: gray;"&gt;=&lt;/span&gt; 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;while &lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;(&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;@i &lt;span style="color: gray;"&gt;&amp;lt;&lt;/span&gt; 3000&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;insert&lt;/span&gt; &lt;span style="color: blue;"&gt;into&lt;/span&gt; t_escalation &lt;span style="color: blue;"&gt;values &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;@i&lt;span style="color: gray;"&gt;,&lt;/span&gt; @i&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;set&lt;/span&gt; @i &lt;span style="color: gray;"&gt;=&lt;/span&gt; @i &lt;span style="color: gray;"&gt;+&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;end&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 14pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;If we run the same update command again in session-1, you will notice that this time, the lock indeed got escalated because the number of rows updated from 4000 to 7000 causing it to cross the lock escalation&amp;nbsp; threshold.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-------------------------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- Show the the last update causes lock to get &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- escalated.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;------------------------------------------------------&lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;declare&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @escalation_counter_before_test &lt;span style="color: blue;"&gt;bigint&lt;/span&gt;&lt;span style="color: gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @escalation_counter_before_test&lt;span style="color: gray;"&gt;=&lt;/span&gt;cntr_value &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;from&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_os_performance_counters&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;where&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;counter_name &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;'Table Lock Escalations/sec'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: red; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;begin&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;tran&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;update&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; t_escalation &lt;span style="color: blue;"&gt;set&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;+&lt;/span&gt; 1 &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;&amp;lt;&lt;/span&gt; 4000&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;declare&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @escalation_counter_after_test &lt;span style="color: blue;"&gt;bigint&lt;/span&gt;&lt;span style="color: gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @escalation_counter_after_test&lt;span style="color: gray;"&gt;=&lt;/span&gt;cntr_value &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;from&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_os_performance_counters&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;where&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; counter_name &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;'Table Lock Escalations/sec'&lt;/span&gt;&lt;span style="color: gray;"&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;print&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: red;"&gt;'lock escalation count '&lt;/span&gt; &lt;span style="color: gray;"&gt;+&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: fuchsia;"&gt;convert&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt; &lt;span style="color: blue;"&gt;varchar&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;100&lt;span style="color: gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@escalation_counter_after_test &lt;span style="color: gray;"&gt;-&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;@escalation_counter_before_test&lt;span style="color: gray;"&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- Here is the output&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;(7000 row(s) affected)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;lock escalation count 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;Now in session-2, if we run the same SELECT, it will get blocked because the locks taken by session-1 have been escalated to table level. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;This is one example where a query that was running without blocking yesterday but has suddenly started seeing blocking.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- Session-2: Run the SELECT query&lt;/span&gt;&lt;span style="color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: gray;"&gt;*&lt;/span&gt; &lt;span style="color: blue;"&gt;from&lt;/span&gt; t_escalation &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 5000&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-50-01/3716.image_2D00_8.jpg" border="0" /&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Solution:&lt;/b&gt; You can choose to disable lock escalation using the following command&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- disable lock escalation to remove the blocking&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;alter&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;table&lt;/span&gt; t_escalation &lt;span style="color: blue;"&gt;set &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;lock_escalation&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: blue;"&gt;DISABLE&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: 'Courier New'; color: gray; font-size: 14pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Thanks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Sunil Agarwal&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10131969" width="1" height="1"&gt;</description></item><item><title>Concurrency Series: Minimizing blocking between updaters</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-minimizing-blocking-between-updaters.aspx</link><pubDate>Sun, 20 Feb 2011 22:24:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10131968</guid><dc:creator>Sunil Agarwal</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10131968</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-minimizing-blocking-between-updaters.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt;"&gt;Author: Sunil Agarwal&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt;"&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: 'Arial','sans-serif';"&gt;Reviewers: Kun Cheng, Chuck Heinzelman, Shaun Tinline-Jones, Sanjay Mishra, And Kevin Liu&lt;/span&gt;&lt;/strong&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;When a transaction T1 modifies a row, it takes an X lock on the row for the duration of the transaction. If another concurrent transaction T2 wants to modify the same row, it gets blocked waiting for T1 to complete. It is easy to understand why this blocking is necessary.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;SQL Server does not know the fate of T1 until it completes so it forces T2 to wait. However, there are situations where a transaction updating a row gets blocked by a transaction updating a totally different row.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Let me illustrate this using the following example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- create a simple table for our examples&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;create&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;table&lt;/span&gt; basic_locking&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;c1 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; c2 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; c3 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;go&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- insert 500 rows into the table&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;declare&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @i &lt;span style="color: blue;"&gt;int&lt;/span&gt; &lt;span style="color: gray;"&gt;=&lt;/span&gt; 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;while &lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;(&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;@i &lt;span style="color: gray;"&gt;&amp;lt;&lt;/span&gt; 500&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;insert&lt;/span&gt; &lt;span style="color: blue;"&gt;into&lt;/span&gt; basic_locking &lt;span style="color: blue;"&gt;values&lt;/span&gt; &lt;span style="color: gray;"&gt;(&lt;/span&gt;@i&lt;span style="color: gray;"&gt;,&lt;/span&gt; @i&lt;span style="color: gray;"&gt;+&lt;/span&gt; 100&lt;span style="color: gray;"&gt;,&lt;/span&gt; @i&lt;span style="color: gray;"&gt;+&lt;/span&gt;10000&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;set&lt;/span&gt; @i &lt;span style="color: gray;"&gt;+=&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;end&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- Session-1: locks the data rows that satisfies the&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- predicate C1 = 1. Based on the data inserted, there&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- is only one row that qualifies&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;begin&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;tran&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;update&lt;/span&gt; basic_locking &lt;span style="color: blue;"&gt;set&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 100 &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;--&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- Session-2:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The update below wants to update a different row&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- but gets blocked on the X lock held by session-1. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;--&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;update&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; basic_locking &lt;span style="color: blue;"&gt;set&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 1000 &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;To understand, why it is blocked, let us first take a look at the &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;query plan for the update statement in session-2.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The query plan shows that the query optimizer has chosen a table scan for the udpate because there is no index on column C1. With the result, the UPDATE statement in session-2 &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;gets blocked while acquiring a UPDLOCK on the row with C1 =2.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-50-01/8182.image_2D00_5.jpg" border="0" /&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;p class="MsoNoSpacing" style="margin: 0in 0in 0pt;"&gt;&lt;span style="mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;The trick of using NOLOCK does not work here because update statement forces the use of UPDLOCK and it will generate the error as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing" style="margin: 0in 0in 0pt;"&gt;&lt;span style="mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;update&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; basic_locking with (NOLOCK)&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;set&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 1000 &lt;span style="color: blue;"&gt;where&lt;/span&gt; (c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 2)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.5in; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="color: red; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;Msg 1065, Level 15, State 1, Line 15&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="color: red; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;The NOLOCK and READUNCOMMITTED lock hints are not allowed for target tables of INSERT, UPDATE, DELETE or MERGE statements.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;The second trick of using RCSI does not work either and the update gets blocked behind X lock by session-1 on row with (C1 = 1). The reason is that the following UPDATE statement executes at a higher isolation level than read committed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;update&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; basic_locking &lt;span style="color: blue;"&gt;set&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 1000 &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Here is the output showing the blocking.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-50-01/5327.image_2D00_6.jpg" border="0" /&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;Solutions:&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt; Here are two choices to address this issue&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="line-height: normal; text-indent: -0.25in; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; mso-add-space: auto;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;1)&lt;/span&gt;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Create an index on column C1 and make sure it gets used either using index hint or using a plan guide. When&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;the index on column C1 is chose,&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;the update statement will directly access the qualifying row with (C1 = 2) and therefore will not get blocked.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="line-height: normal; text-indent: -0.25in; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; mso-add-space: auto;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;2)&lt;/span&gt;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;You can execute the update in session-2 under snapshot isolation level as follows&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none; mso-add-space: auto;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- set isolation level to SNAPSHOT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;set&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;transaction&lt;/span&gt; &lt;span style="color: blue;"&gt;isolation&lt;/span&gt; &lt;span style="color: blue;"&gt;level&lt;/span&gt; &lt;span style="color: blue;"&gt;snapshot&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;begin&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;tran&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;-- enable Snapshot Isolation and now update the row&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;-- without blocking on session-1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;update&lt;/span&gt; basic_locking &lt;span style="color: blue;"&gt;set&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 1000 &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraph" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none; mso-add-space: auto;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;The transaction under SI does not take UPDLOCK and therefore it does not get blocked on session-1 and can successfully updates the qualifying row with C1 = 2. However, like under any other transaction, an&lt;/span&gt;&lt;a name="_GoBack"&gt;&lt;/a&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt; X lock is acquired on the row before modifying it. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;You may wonder what happens if we update the same row that was modified under session-1? Will it lead to lost update for the changes done under session-1? Here is the new UPDATE statement in session-2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- set isolation level to SNAPSHOT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;set&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;transaction&lt;/span&gt; &lt;span style="color: blue;"&gt;isolation&lt;/span&gt; &lt;span style="color: blue;"&gt;level&lt;/span&gt; &lt;span style="color: blue;"&gt;snapshot&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;begin&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;tran&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;-- enable Snapshot Isolation and now update the row&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;-- this will not block&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;update&lt;/span&gt; basic_locking &lt;span style="color: blue;"&gt;set&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 1000 &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;In this case, the transaction under SI will get blocked while acquiring the X lock on the row as it has been concurrently modified by session-1. When the lock is ultimately acquired (i.e. the transaction in session-1 completes), a check is made if the same row was modified by a concurrent transaction that had committed and in that case, the concurrent change under the SI transaction is aborted by raising the following error.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The update could have succeeded in session-2 if the update transaction in session-1 was aborted.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: red; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;Msg 3960, Level 16, State 4, Line 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: red; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation to access table 'dbo.basic_locking' directly or indirectly in database 'locktest' to update, delete, or insert the row that has been modified or deleted by another transaction. Retry the transaction or change the isolation level for the update/delete statement.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Thanks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Sunil Agarwal&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10131968" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Concurrency/">Concurrency</category></item><item><title>Concurrency Series: Why do I get blocked when no one has locked the row(s) being queried?</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-why-do-i-get-block-when-no-one-has-locked-the-row-s-being-queried.aspx</link><pubDate>Sun, 20 Feb 2011 22:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10131967</guid><dc:creator>Sunil Agarwal</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10131967</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-why-do-i-get-block-when-no-one-has-locked-the-row-s-being-queried.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;strong&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt;"&gt;Author: Sunil Agarwal&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt;"&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: 'Arial','sans-serif';"&gt;Reviewers: Kun Cheng, Chuck Heinzelman, Shaun Tinline-Jones, Sanjay Mishra, Kevin Liu&lt;/span&gt;&lt;/strong&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;Recently I was working with a customer who was surprised to see blocking when accessing a data row which was not locked?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Let me describe the scenario using an example.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- create a simple table for our examples&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;create&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;table&lt;/span&gt; basic_locking&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;c1 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; c2 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; c3 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;go&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- insert 500 rows into the table&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;declare&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @i &lt;span style="color: blue;"&gt;int&lt;/span&gt; &lt;span style="color: gray;"&gt;=&lt;/span&gt; 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;while &lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;(&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;@i &lt;span style="color: gray;"&gt;&amp;lt;&lt;/span&gt; 500&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;insert&lt;/span&gt; &lt;span style="color: blue;"&gt;into&lt;/span&gt; basic_locking &lt;span style="color: blue;"&gt;values&lt;/span&gt; &lt;span style="color: gray;"&gt;(&lt;/span&gt;@i&lt;span style="color: gray;"&gt;,&lt;/span&gt; @i&lt;span style="color: gray;"&gt;+&lt;/span&gt; 100&lt;span style="color: gray;"&gt;,&lt;/span&gt; @i&lt;span style="color: gray;"&gt;+&lt;/span&gt;10000&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;set&lt;/span&gt; @i &lt;span style="color: gray;"&gt;+=&lt;/span&gt; 1&lt;/span&gt;&lt;a name="_GoBack"&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;end&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- Session-1: locks the data rows that satisfies the&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- predicate C1 = 1. Based on the data inserted, there&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- is only one row that qualifies&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;begin&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;tran&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;update&lt;/span&gt; basic_locking &lt;span style="color: blue;"&gt;set&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 100 &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- Session-2: Set the isolation level to default&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;set&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;transaction&lt;/span&gt; &lt;span style="color: blue;"&gt;isolation&lt;/span&gt; &lt;span style="color: blue;"&gt;level&lt;/span&gt; &lt;span style="color: blue;"&gt;read&lt;/span&gt; &lt;span style="color: blue;"&gt;committed&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- select a different row and show that it blocks&lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; c3 &lt;span style="color: blue;"&gt;from&lt;/span&gt; basic_locking &lt;span style="color: blue;"&gt;where&lt;/span&gt; c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The customer wondered why session-2 is seeing blocking even though no other transaction has locked the row satisying the predicate c1=2? To understand this, let us look at the query plan for the SELECT operation&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-50-01/5125.image_2D00_3.jpg" border="0" /&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Since there is no index on this table, the optimizer chooses the table scan to execute the query in session-2. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;As part of&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;this plan, the predicate (C1 = 2) is applied to each row (including the one that has C1 set to 1). Since the data row with (C1 = 1) is already exclusively&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;locked (X) by the transaction in session-1, it will block session-2. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;I strongly recommend customers to look at query plans while troubleshooting blocking issues.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;Solutions&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;: You have multiple choices here. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;1)&lt;/span&gt;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Use NOLOCK locking hint&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt; c3 &lt;span style="color: blue;"&gt;from&lt;/span&gt; basic_locking &lt;span style="color: blue;"&gt;with&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;NOLOCK&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;span style="color: blue;"&gt;where&lt;/span&gt; (c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 2).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;However, it requires an application change&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;2)&lt;/span&gt;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Enable RCSI (read committed snapshot). This provide non blocking access to the data row with (c1 = 2). This will work and will not require application change.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;3)&lt;/span&gt;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Enable SI (Snapshot Isolation) but it will require application change.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;4)&lt;/span&gt;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;Create an index on column C1. The blocking will be eliminated if optimizer chooses the index to execute SELECT statement in session-2. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;create&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;nonclustered&lt;/span&gt; &lt;span style="color: blue;"&gt;index&lt;/span&gt; basic_locking_nci &lt;span style="color: blue;"&gt;on&lt;/span&gt; basic_locking&lt;span style="color: gray;"&gt;(&lt;/span&gt;c1&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;go&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- force the access through an index to remove &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- blocking&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; c3 &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;from&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; basic_locking &lt;span style="color: blue;"&gt;with (index(&lt;/span&gt;basic_locking_nci&lt;span style="color: gray;"&gt;))&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;where&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; c1 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 14pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Here is how the query plan looks like&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-50-01/3007.image_2D00_4.png" border="0" /&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;There is a catch here. If optimizer does not choose this index, you may still get blocking. In that case, you will need to change your application for force the index hint or use plan-guide to direct optimizer to choose this index. Note, with the new index, the DML operations (Insert, Delete, and Update) will incur overhead of maintaining additional index.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; font-size: 14pt; mso-no-proof: yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Thanks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Sunil Agarwal&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10131967" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Concurrency/">Concurrency</category></item><item><title>Concurrency Series: Why do I get blocking when I use Read Uncommitted isolation level or use NOLOCK hint?</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-why-do-i-get-blocking-when-i-use-read-uncommitted-isolation-level-or-use-nolock-hint.aspx</link><pubDate>Sun, 20 Feb 2011 22:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10131964</guid><dc:creator>Sunil Agarwal</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10131964</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-why-do-i-get-blocking-when-i-use-read-uncommitted-isolation-level-or-use-nolock-hint.aspx#comments</comments><description>&lt;p&gt;&lt;span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: black; FONT-SIZE: 9pt"&gt;&lt;span&gt;&lt;span&gt;
&lt;p&gt;&lt;span&gt;&lt;strong&gt;Author: Sunil Agarwal&lt;br /&gt;&lt;span style="font-family: 'Arial','sans-serif';"&gt;Reviewers: Kun Cheng, Chuck Heinzelman, Shaun Tinline-Jones, Sanjay Mishra, Kevin Liu&lt;/span&gt;&lt;/strong&gt;&lt;a name="_GoBack"&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;When using NOLOCK hint on the table or using read uncommitted isolation level, customers sometimes get surprised when they experience blocking. Let me explain this using the following example&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;Example:&lt;/strong&gt; Concurrent DDL operation&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- create a simple table for our examples&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;create&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;table&lt;/span&gt; basic_locking&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;c1 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; c2 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; c3 &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;go&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- insert 500 rows into the table&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;declare&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; @i &lt;span style="color: blue;"&gt;int&lt;/span&gt; &lt;span style="color: gray;"&gt;=&lt;/span&gt; 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;while &lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: gray; mso-no-proof: yes;"&gt;(&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;@i &lt;span style="color: gray;"&gt;&amp;lt;&lt;/span&gt; 500&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;begin&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;insert&lt;/span&gt; &lt;span style="color: blue;"&gt;into&lt;/span&gt; basic_locking &lt;span style="color: blue;"&gt;values &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;@i&lt;span style="color: gray;"&gt;,&lt;/span&gt; @i&lt;span style="color: gray;"&gt;+&lt;/span&gt; 100&lt;span style="color: gray;"&gt;,&lt;/span&gt; @i&lt;span style="color: gray;"&gt;+&lt;/span&gt;10000&lt;span style="color: gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;set&lt;/span&gt; @i &lt;span style="color: gray;"&gt;+=&lt;/span&gt; 1 &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;end&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- In session-1, do an update in a transaction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- It will acquire X lock on all the rows in the table&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- or possibly an X lock on the table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;begin&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: blue;"&gt;tran&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;update&lt;/span&gt; basic_locking &lt;span style="color: blue;"&gt;set&lt;/span&gt; c2 &lt;span style="color: gray;"&gt;=&lt;/span&gt; 1000 where c1 = 1&lt;span style="color: green;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;-- script to show blocking and locks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;span style="color: gray;"&gt;.&lt;/span&gt;request_session_id &lt;span style="color: blue;"&gt;as&lt;/span&gt; spid&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;span style="color: gray;"&gt;.&lt;/span&gt;resource_type &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: blue;"&gt;type&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;span style="color: gray;"&gt;.&lt;/span&gt;resource_database_id &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: blue;"&gt;dbid&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;span style="color: gray;"&gt;.&lt;/span&gt;resource_description &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: blue;"&gt;description&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;span style="color: gray;"&gt;.&lt;/span&gt;request_mode &lt;span style="color: blue;"&gt;as&lt;/span&gt; mode&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;span style="color: gray;"&gt;.&lt;/span&gt;request_status &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: blue;"&gt;status&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;from&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_tran_locks&lt;/span&gt; &lt;span style="color: blue;"&gt;as&lt;/span&gt; t1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;where&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt; t1&lt;span style="color: gray;"&gt;.&lt;/span&gt;request_session_id &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;@@SPID&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: fuchsia; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;Here is the output of the locks taken using the following query. Since only one row is being updated, you see a X lock on the data row and the IX lock on the data page (i.e. 153)containing the row and IX lock on the table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x100/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-50-01/6318.block_2D00_1.jpg" border="0" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;p&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;span style="font-size: small;"&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- Session-2 use read uncommitted to access the data. Since the query &amp;ndash;- is executed with NOLOCK hint or read uncommitted isolation level,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- it will run without getting blocked&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;begin&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;tran&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; text-indent: 0.5in; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- As expected, this select will not block &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; text-indent: 0.5in; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- and will return 100 which &amp;lsquo;dirty&amp;rsquo; data&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&lt;span style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;select&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;top&lt;/span&gt;&lt;span style="color: #000000;"&gt; 1 &lt;/span&gt;&lt;span style="color: gray;"&gt;c1&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;from&lt;/span&gt;&lt;span style="color: #000000;"&gt; basic_locking with (NOLOCK)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;o:p&gt;&lt;span style="color: #000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt;Now,let us execute the DDL operation in session-1 as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- In session-1, add a column to the table under the same&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- transaction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;alter&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;table&lt;/span&gt;&lt;span style="color: #000000;"&gt; basic_locking &lt;/span&gt;&lt;span style="color: blue;"&gt;add&lt;/span&gt;&lt;span style="color: #000000;"&gt; c4 &lt;/span&gt;&lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; color: #000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- Session-2 use read uncommitted to access the data&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- This statement will block while waiting to to acquire &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- SCH-S lock on the table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt; c2 &lt;/span&gt;&lt;span style="color: blue;"&gt;from&lt;/span&gt;&lt;span style="color: #000000;"&gt; basic_locking with&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;NOLOCK&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;where&lt;/span&gt;&lt;span style="color: #000000;"&gt; c1 &lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; 1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: green; mso-no-proof: yes;"&gt;-- use the following script to show blocking and locks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;select&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: #000000;"&gt;request_session_id &lt;/span&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;span style="color: #000000;"&gt; spid&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: #000000;"&gt;resource_type &lt;/span&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;type&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: #000000;"&gt;resource_database_id &lt;/span&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;dbid&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: #000000;"&gt;request_mode &lt;/span&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;span style="color: #000000;"&gt; mode&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: #000000;"&gt;request_status &lt;/span&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;status&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;t2&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: #000000;"&gt;blocking_session_id&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;from&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_tran_locks&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;span style="color: #000000;"&gt; t1 &lt;/span&gt;&lt;span style="color: gray;"&gt;left&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;outer&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;join&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_os_waiting_tasks&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;span style="color: #000000;"&gt; t2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;ON&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt; t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: #000000;"&gt;lock_owner_address &lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; t2&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: #000000;"&gt;resource_address &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: 'Courier New'; color: blue; mso-no-proof: yes;"&gt;WHERE&lt;/span&gt;&lt;span style="font-family: 'Courier New'; mso-no-proof: yes;"&gt;&lt;span style="color: #000000;"&gt; t1&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: #000000;"&gt;request_status &lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;'WAIT'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; color: #000000;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;span style="font-family: Calibri; color: #000000;"&gt;Here is the output that shows that session -1 (SPID-51) is blocking session-2(SPID-54) on SCH-S lock request.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x50/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-50-01/2335.block_2D00_2.jpg" border="0" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The reason for this blocking is that during the execution of a SQL statement, the SQL Server requires a schema stability lock (i.e. SCH-S) on objects referenced in the statement to protect against concurrent DDL. For the simple example above, if this lock was not taken, the question will be should the returned rows have 3 column or 4 columns? Or the rows that were returned before DDL operation committed show 3 columns while the remaining rows show 4 columns?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;In fact, if you use RCSI mode or snapshot isolation level, the query will get blocked similarly. Since DDL is a not a common operation in production environment, this kind of blocking should happen rarely.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Thanks&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Sunil Agarwal&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10131964" width="1" height="1"&gt;</description></item><item><title>Concurrency Series: Basics of Transaction Isolation Levels</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-basics-of-transaction-isolation-levels.aspx</link><pubDate>Sun, 20 Feb 2011 21:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10131952</guid><dc:creator>Sunil Agarwal</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10131952</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/02/20/concurrency-series-basics-of-transaction-isolation-levels.aspx#comments</comments><description>&lt;p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt;"&gt;Author: Sunil Agarwal&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt;"&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: 'Arial','sans-serif';"&gt;Reviewers: Kun Cheng, Chuck Heinzelman, Shaun Tinline-Jones, Sanjay Mishra, Kevin Liu&lt;/span&gt;&lt;/strong&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;In this series of blogs, I want to show some common concurrency questions that we get asked by customers. Before we look into common concurrency issues seen by customers, it will be good to review the transaction isolation levels provided in SQL Server.&lt;a name="_GoBack"&gt;&lt;/a&gt;&lt;span style="line-height: 115%; font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="line-height: 115%; font-size: 14pt;"&gt;Isolation Levels&lt;/span&gt;&lt;/b&gt;: SQL Server supports all four isolation levels as defined in ANSI SQL standard. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;The ANSI standard does not dictate how these need to implemented but SQL Server has implemented them using locks with the exception of RCSI/SI that I will discuss later. These isolation levels are:&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1;"&gt;&lt;span style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Read Uncommitted (aka dirty read):&lt;/b&gt; A transaction T1 executing under this isolation level can access data changed by concurrent transaction(s). For example, if a concurrent transaction T2 updates a row R1, it can still be read under T1 even though T2 can potentially roll back later. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Pros:&lt;/b&gt; &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;No read locks needed to read data (i.e. no reader/writer blocking). Note, T1 still takes transaction duration locks for any data modified.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Cons:&lt;/b&gt; &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;Data is not guaranteed to be transactionally consistent.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Usage:&lt;/b&gt; It is typically used in queries/applications where data inconsistency can be tolerated. For example, computing average salary of employees.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 1in; mso-add-space: auto;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1;"&gt;&lt;span style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Read Committed:&lt;/b&gt; A transaction T1 executing under this isolation level can only access committed data. For example, if a concurrent transaction T2 updates a row R1, it cannot be accessed under T1, in fact T1 will get blocked until T2 either commits or rolls back. The S (i.e. Share) lock is held when accessing the data and is released once the access is complete.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;So for example, if T1 reads R1, R2, and R3 in a SQL statement, T1 acquires/releases S lock on R1 and then acquires/releases lock on R2. In some cases, the &amp;lsquo;S&amp;rsquo; lock is not released until the end of the statement but for now we will not discuss that.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Pros:&lt;/b&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Good compromise between concurrency and consistency. &lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Cons:&lt;/b&gt; Locking and blocking. The data can change when accessed multiple times within the same transaction.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Usage:&lt;/b&gt; Very commonly used isolation level. In fact, this is the default isolation level in SQL Server.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 1in; mso-add-space: auto;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1;"&gt;&lt;span style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Repeatable Read:&lt;/b&gt; A transaction T1 executing under this isolation level can only access committed data with an additional guarantee that any data read cannot change (i.e. it is repeatable)&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;for the duration of the transaction. SQL Server achieves it by holding an S lock for the duration of the transaction. However, it does not protect phantoms, new data rows that qualify the query predicate can appear. &lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Example:&lt;/b&gt; Assume there is a table &lt;i style="mso-bidi-font-style: normal;"&gt;ACCOUNTS&lt;/i&gt; that stores customer&amp;rsquo;s account information along with the money balance. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo3; mso-add-space: auto;"&gt;&lt;span style="font-family: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;Oslash;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Start a transaction (T1) under repeatable read isolation level. Query&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;the &lt;i style="mso-bidi-font-style: normal;"&gt;ACCOUNTS&lt;/i&gt; table with predicate &lt;i style="mso-bidi-font-style: normal;"&gt;(account_balance &amp;gt; 1000). &lt;/i&gt;Let us say it returns 10 rows&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo3; mso-add-space: auto;"&gt;&lt;span style="font-family: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;Oslash;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Another transaction (T2) inserts a new row in the ACCOUNTS table with account_balance = 1020 and commits.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo3; mso-add-space: auto;"&gt;&lt;span style="font-family: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;Oslash;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Query the &lt;i style="mso-bidi-font-style: normal;"&gt;ACCOUNTS&lt;/i&gt; table again with the same predicate &lt;i style="mso-bidi-font-style: normal;"&gt;(account_balance &amp;gt; 1000) &lt;/i&gt;and it will return 11 rows. The reason is that transaction T1 only locked the 10 qualifying rows but did not lock the predicate range. With the result, the transaction T2 could insert a new row in the same predicate range.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Pros:&lt;/b&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Higher data consistency.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Cons:&lt;/b&gt; Locking and blocking.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The S locks are held for the duration of the transaction that can lower the concurrency. It does not protect against phantom rows.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Usage:&lt;/b&gt; Not very common.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1;"&gt;&lt;span style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Serializable:&lt;/b&gt; A transaction T1 executing under this isolation level provides the highest data consistency including elimination of phantoms but at the cost of reduced concurrency. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;It prevents phantoms by taking a range lock or table level lock if range lock can&amp;rsquo;t be acquired (i.e. no index on the predicate column) for the duration of the transaction.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Pros:&lt;/b&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Full data consistency including phantom protection. Serializable isolation level guarantees transactions will end up with one possible serial order with an appearance that concurrent transactions did not interfere with each other. For example, if T1, T2, T3 are running under serializable isolation level, the possible serial orders are (T1, T2, T3), (T1, T3, T2), (T2, T1, T3), (T2, T3, T1), (T3, T1, T2), (T3, T2, T1).&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Cons:&lt;/b&gt; Locking and blocking.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The S locks are held for the duration of the transaction that can lower the concurrency. &lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l2 level2 lfo1; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Usage:&lt;/b&gt; It is used in cases where data consistency is an absolute requirement. &lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="margin: 0in 0in 10pt 0.5in;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;In addition to these isolation level, SQL Server, starting with SQL Server 2005 release, added two changes as follows&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2;"&gt;&lt;span style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Read-Committed-Snapshot (RCSI):&lt;/b&gt; This is not a new isolation level but a new implementation of read committed isolation level that does not take any S lock on the data. The word snapshot stems from the fact that query under RCSI sees the snapshot of the database as of the beginning of the statement.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;It is a better alternative for applications that must access only committed data but without taking locks. SQL Server implements it using row versioning that has some overhead. You can map blocking implementation of read committed isolation level to RCSI by enabling READ_COMMITTED_SNAPSHOT option at the database level without forcing any changes to applications.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l0 level2 lfo2; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Pros:&lt;/b&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Non-blocking access to transactionally consistent data.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l0 level2 lfo2; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Cons:&lt;/b&gt; Some overhead of maintaining row versions. &lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l0 level2 lfo2; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Usage:&lt;/b&gt; To minimize reader/writer blocking and to replace &amp;lsquo;read uncommitted&amp;rsquo; or NOLOCK access to data with transactional consistent data&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2;"&gt;&lt;span style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;&amp;middot;&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Snapshot Isolation (SI)&lt;/b&gt;: This is new proprietary isolation level that provides non-blocking access for read operations. The transactions under SI see the snapshot of the database as of the beginning of the transaction.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;There is no automatic mapping of transaction isolation levels to SI so you must change your application to access data under SI isolation level. &lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l0 level2 lfo2; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Pros:&lt;/b&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Non-blocking access to transactionally consistent data. Higher consistency than repeatable read.&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l0 level2 lfo2; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Cons:&lt;/b&gt; Some overhead of maintaining row versions. &lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="text-indent: -0.25in; margin: 0in 0in 10pt 1in; mso-list: l0 level2 lfo2; mso-add-space: auto;"&gt;&lt;span style="font-family: 'Courier New'; mso-fareast-font-family: 'Courier New';"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;Usage:&lt;/b&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;To get non-blocking access to consistent data across multiple statements within a transaction.&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;As an aside, you can explicitly set isolation levels by executing &amp;lsquo;set transaction isolation level &amp;lt;isolation&amp;gt;&amp;rsquo; or you can override it at an object level in a statement using locking hints. &lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;Thanks&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt;"&gt;Sunil Agarwal&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;span style="font-family: Calibri; font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10131952" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/Concurrency/">Concurrency</category></item><item><title>What is the SSAS Maestros?</title><link>http://blogs.msdn.com/b/sqlcat/archive/2011/01/31/what-is-the-ssas-maestros.aspx</link><pubDate>Mon, 31 Jan 2011 04:07:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10122171</guid><dc:creator>Denny Lee [MSFT]</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/sqlcat/rsscomments.aspx?WeblogPostID=10122171</wfw:commentRss><comments>http://blogs.msdn.com/b/sqlcat/archive/2011/01/31/what-is-the-ssas-maestros.aspx#comments</comments><description>&lt;p&gt;by Denny Lee (SQL Customer Advisory Team), Daniel Yu (SQL Marketing)&lt;/p&gt;
&lt;p&gt;Over the last few weeks, there has been a lot of questions, tweets, and rumors about the SSAS Maestros program &amp;ndash; some notable blogs include Kasper de Jonge&amp;rsquo;s &lt;a href="http://www.powerpivotblog.nl/do-you-have-what-it-takes-to-become-ssas-maestro"&gt;&lt;span style="color: #265e15;"&gt;Do you have what it takes to become SSAS Maestro&lt;/span&gt;&lt;/a&gt; and &lt;a href="http://www.ssas-info.com/VidasMatelisBlog/208_ssas-white-paper-list"&gt;&lt;span style="color: #265e15;"&gt;Vidas Matelis&amp;rsquo; SSAS White Paper List&lt;/span&gt;&lt;/a&gt;.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Background Information&lt;/h3&gt;
&lt;p&gt;We had created the SSAS Maestros program as a way to broadcast the lessons learned from some of SQLCAT&amp;rsquo;s more complex &lt;strong&gt;Analysis Services UDM enterprise customers&lt;/strong&gt; &amp;ndash; such as &lt;span style="text-decoration: underline;"&gt;Yahoo!&amp;rsquo;s 12TB Analysis Services&lt;/span&gt; cube that was announced during the &lt;a href="http://www.sqlpass.org/summit/na2010/LiveKeynotes/Tuesday.aspx"&gt;&lt;span style="color: #265e15;"&gt;PASS Summit 2010 Day One Keynote&lt;/span&gt;&lt;/a&gt; with Ted Kummert.&amp;nbsp; The deep technical learnings from names like Akshai Mirchandani, Thomas Kejser, John Sirmon, Denny Lee, and more!&amp;nbsp;have been incorporated together by our good friends from Solid Quality Mentors into a three-day deep dive course in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://msevents.microsoft.com/cui/EventDetail.aspx?culture=en-US&amp;amp;EventID=1032472475&amp;amp;IO=HT9BRXmMrXbID%2bcW7AjWxA%3d%3d"&gt;&lt;span style="color: #265e15;"&gt;Redmond&lt;/span&gt;&lt;/a&gt;&amp;nbsp;(fully booked now, though we&amp;rsquo;re planning a second US session shortly)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://msevents.microsoft.com/cui/EventDetail.aspx?culture=en-US&amp;amp;EventID=1032474710&amp;amp;IO=o%2bHwN29JgR9eNB%2f%2b2b8rDw%3d%3d"&gt;&lt;span style="color: #265e15;"&gt;London&lt;/span&gt;&lt;/a&gt;&amp;nbsp;(fully booked now, though we&amp;rsquo;re looking into a second London session)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://msevents.microsoft.com/cui/EventDetail.aspx?culture=en-US&amp;amp;EventID=1032473451&amp;amp;IO=SO2IuKtrEIuIuXl4dJMd2A%3d%3d"&gt;&lt;span style="color: #265e15;"&gt;Hong Kong&lt;/span&gt;&lt;/a&gt;: still available!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We will have more courses planned but this is the initial batch of courses as we will be working out the kinks and improving the course over time.&amp;nbsp; Currently, we&amp;rsquo;ve made this a 11 module course with labs and exams.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Benefits&lt;/h3&gt;
&lt;p&gt;As noted in the above MS events course link&amp;nbsp;as well as Kasper&amp;rsquo;s blog, the key&amp;nbsp;benefit will be&amp;nbsp;of course the material that you learn.&amp;nbsp; But&amp;nbsp;some of the other great&amp;nbsp;things include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Be&amp;nbsp;one of the few&amp;nbsp;part of the&amp;nbsp;elite SSAS Maestros (more&amp;nbsp;on this later)&lt;/li&gt;
&lt;li&gt;The SSAS Maestros list will be published on a Microsoft site for your customers to reference.&lt;/li&gt;
&lt;li&gt;When SQLCAT needs&amp;nbsp;someone to help with a complex SSAS engagement or needs to refer to a partner&amp;nbsp;&amp;ndash; we will refer to a SSAS Maestro.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SQLCAT and the Analysis Services team will be creating SSAS Maestros-only webcasts and Q&amp;amp;A sessions - This will be an &lt;span style="text-decoration: underline;"&gt;exclusive&lt;/span&gt; forum to discuss the latest best practice and share critical knowledge&lt;/strong&gt;&amp;nbsp; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As you can see, there is a lot of great benefits to this great course!&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;But&amp;hellip;what&amp;rsquo;s the catch?&lt;/h3&gt;
&lt;p&gt;Due to its complexity and our dive into deep technical learnings, this is not going to be an easy course.&amp;nbsp; Some examples of this include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Following technical conference conventions of 400 level sessions, we consider this a &lt;strong&gt;500 level &lt;/strong&gt;course.&lt;/li&gt;
&lt;li&gt;There is an application to do this course and entrants are accepted based on showcasing their deep technical experience with Analysis Services.&lt;/li&gt;
&lt;li&gt;During the three-day course, there will be a number of labs which will have very little guidance (on purpose).&lt;/li&gt;
&lt;li&gt;Upon completion of the course, there will be a take-home exam project that will need to be completed within thirty (30 days).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We have been drawing inspiration from the &lt;a href="http://www.microsoft.com/learning/en/us/certification/master-sql.aspx"&gt;&lt;span style="color: #265e15;"&gt;SQL Server MCM&lt;/span&gt;&lt;/a&gt; course&amp;nbsp;&amp;ndash; which many of you know is extremely tough!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Discussion&lt;/h3&gt;
&lt;p&gt;As this is the first year of the course, we will be very strict and limit the number of applicants into the course.&amp;nbsp; This allows us to work out the kinks in the course as well as figure out logistics around the webcasts and exams / re-examinations.&amp;nbsp; But due to its popularity, we are already rapidly working on planning V2 of the course! So stay tuned!!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10122171" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/analysis+services/">analysis services</category><category domain="http://blogs.msdn.com/b/sqlcat/archive/tags/BI/">BI</category></item></channel></rss>
