{"id":609,"date":"2010-02-11T15:46:00","date_gmt":"2010-02-11T15:46:00","guid":{"rendered":"\/blogs\/bobb\/post\/Transactions-isolation-and-SQL-Azure.aspx"},"modified":"2013-01-03T23:59:40","modified_gmt":"2013-01-04T07:59:40","slug":"transactions-isolation-and-sql-azure","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/","title":{"rendered":"Transactions, isolation, and SQL Azure"},"content":{"rendered":"<p>\nI was trundling through my SQL Azure database today, looking for interesting behaviors. Found one. A &quot;select * from sys.databases&quot;&nbsp; reveals that both &quot;snapshot_isolation_state&quot; and &quot;is_read_committed_snapshot_on&quot; return 1 (on) for all databases. Because ALTER DATABASE isn&#39;t supported, these cannot be changed.\n<\/p>\n<p>\nSo READ COMMITTED SNAPSHOT is the default transaction isolation level, which may come as a surprise to those applications that depend on the read committed locking behavior of SQL Server. Although so far there&#39;s been no big hue and&nbsp;cry.&nbsp;The readcommittedlock query hint works as expected, but if you&#39;re expecting read locks, you won&#39;t get them by default. And the other three locking-based isolation levels are available, SQL Azure is SQL Server after all, just with the two snapshot isolation switches turned on.\n<\/p>\n<p>\nRemember also that the SQL Azure session timeout will rollback uncommitted transactions in progress (as it should). I was reminded of that while testing isolation levels and forgetting to commit a transaction.\n<\/p>\n<p>\nThere isn&#39;t much reference to this in the SQL Azure Books Online, and although I did find a reference to this in the <a href=\"http:\/\/social.msdn.microsoft.com:80\/Forums\/en-US\/windowsazuredata\/thread\/6514c399-079d-451b-ae2d-59763c8cfb54\">SQL Azure FAQ<\/a>, the FAQ says &quot;snapshot isolation&quot; is the default. Technically it&#39;s &quot;read committed snapshot&quot; (known also as &quot;statement-level snapshot&quot;) that&#39;s the default, although the SQL Server snapshot isolation level (known as &quot;transaction-level snapshot&quot;) is available and works as advertised.\n<\/p>\n<p>\nThis may be for the best, because you can&#39;t use either the dynamic management views or sp_lock to observe the locks in your instance\/database in any case. A final point of interest is that application locks are supported, but lack of visibility would mean it may be difficult to troubleshoot these.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was trundling through my SQL Azure database today, looking for interesting behaviors. Found one. A &quot;select * from sys.databases&quot;&nbsp; reveals that both &quot;snapshot_isolation_state&quot; and &quot;is_read_committed_snapshot_on&quot; return 1 (on) for all databases. Because ALTER DATABASE isn&#39;t supported, these cannot be changed. So READ COMMITTED SNAPSHOT is the default transaction isolation level, which may come as [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-609","post","type-post","status-publish","format-standard","hentry","category-sql-azure-database"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Transactions, isolation, and SQL Azure - Bob Beauchemin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Transactions, isolation, and SQL Azure - Bob Beauchemin\" \/>\n<meta property=\"og:description\" content=\"I was trundling through my SQL Azure database today, looking for interesting behaviors. Found one. A &quot;select * from sys.databases&quot;&nbsp; reveals that both &quot;snapshot_isolation_state&quot; and &quot;is_read_committed_snapshot_on&quot; return 1 (on) for all databases. Because ALTER DATABASE isn&#039;t supported, these cannot be changed. So READ COMMITTED SNAPSHOT is the default transaction isolation level, which may come as [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/\" \/>\n<meta property=\"og:site_name\" content=\"Bob Beauchemin\" \/>\n<meta property=\"article:published_time\" content=\"2010-02-11T15:46:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-04T07:59:40+00:00\" \/>\n<meta name=\"author\" content=\"Bob Beauchemin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bob Beauchemin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/\",\"name\":\"Transactions, isolation, and SQL Azure - Bob Beauchemin\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\"},\"datePublished\":\"2010-02-11T15:46:00+00:00\",\"dateModified\":\"2013-01-04T07:59:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Azure SQL Database\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/sql-azure-database\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Transactions, isolation, and SQL Azure\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\",\"name\":\"Bob Beauchemin\",\"description\":\"SQL Server Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\",\"name\":\"Bob Beauchemin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"caption\":\"Bob Beauchemin\"},\"sameAs\":[\"http:\/www.sqlskills.com\/blogs\/bobb\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Transactions, isolation, and SQL Azure - Bob Beauchemin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/","og_locale":"en_US","og_type":"article","og_title":"Transactions, isolation, and SQL Azure - Bob Beauchemin","og_description":"I was trundling through my SQL Azure database today, looking for interesting behaviors. Found one. A &quot;select * from sys.databases&quot;&nbsp; reveals that both &quot;snapshot_isolation_state&quot; and &quot;is_read_committed_snapshot_on&quot; return 1 (on) for all databases. Because ALTER DATABASE isn&#39;t supported, these cannot be changed. So READ COMMITTED SNAPSHOT is the default transaction isolation level, which may come as [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/","og_site_name":"Bob Beauchemin","article_published_time":"2010-02-11T15:46:00+00:00","article_modified_time":"2013-01-04T07:59:40+00:00","author":"Bob Beauchemin","twitter_misc":{"Written by":"Bob Beauchemin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/","name":"Transactions, isolation, and SQL Azure - Bob Beauchemin","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website"},"datePublished":"2010-02-11T15:46:00+00:00","dateModified":"2013-01-04T07:59:40+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/transactions-isolation-and-sql-azure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/"},{"@type":"ListItem","position":2,"name":"Azure SQL Database","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/sql-azure-database\/"},{"@type":"ListItem","position":3,"name":"Transactions, isolation, and SQL Azure"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/","name":"Bob Beauchemin","description":"SQL Server Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e","name":"Bob Beauchemin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","caption":"Bob Beauchemin"},"sameAs":["http:\/www.sqlskills.com\/blogs\/bobb\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/comments?post=609"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/609\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/media?parent=609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/categories?post=609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/tags?post=609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}