Warning: Constant WP_TEMP_DIR already defined in /var/www/html/blogs/joe/wp-config.php on line 93

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902
{"id":478,"date":"2012-09-11T11:05:05","date_gmt":"2012-09-11T11:05:05","guid":{"rendered":"\/blogs\/joe\/post\/What-Does-the-Future-Hold-for-Cardinality-Estimates-and-Cost-Models-in-Windows-Azure-SQL-Database.aspx"},"modified":"2013-12-29T19:16:08","modified_gmt":"2013-12-30T03:16:08","slug":"what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/","title":{"rendered":"What Does the Future Hold for Cardinality Estimates and Cost Models in Windows Azure SQL Database?"},"content":{"rendered":"

I\u2019ve been interested in exploring what changes may be coming through in SQL Azure (Windows Azure \u2013 \u201cSQL Database\u201d now) around query execution cost models and cardinality estimates being fed to them.\u00a0 This was motivated by a couple of things\u2026<\/p>\n

First of all, I saw a blog post from Grant Fritchey<\/a> where he noticed that the estimated costs for a few plan operators were different.<\/p>\n

Secondly, I read a paper called \u201cTesting Cardinality Estimation Models in SQL Server<\/a>\u201d by Campbell Fraser, Leo Giakoumakis, Vikas Hamine, and Katherine F. Moore-Smith.\u00a0 This was a for-fee article, but the non-member price of $15.00 was worth it.\u00a0 One particularly interesting quote was as follows:<\/p>\n

\u201cThe new CE model is planned as a future service release of the Microsoft SQL Azure service.\u201d<\/p><\/blockquote>\n

That quote was a tipping point for further investigation, so, collaborating with Jonathan Kehayias, we discussed a testing approach and set up two different Azure databases, with one database on Web Edition and the other Business Edition.\u00a0 The intention wasn\u2019t to perform \u201cformal\u201d tests, but I did want to sniff around and see what variations in cost and cardinality estimates I could find (if any) between SQL Azure (version 11.0.2006) and SQL Server 2012 (version 11.0.2316) across various types of queries.\u00a0 I used the Credit database for a variety of test queries \u2013 with identical schema and data in all three databases (one engine DB and two Azure DBs).<\/p>\n

One thing I\u2019ve learned so far is that you should watch out for is misinterpreting cost differences for \u201cidentical\u201d databases.\u00a0 Even if you load the same exact schema and rows, you will likely have a different data page count between Engine and Azure (think of the Azure fillfactor and RCSI behavior).\u00a0 For example, after loading my dbo.member table in SQL Azure, it had 159 pages versus the 142 pages in my SQL Server 2012 version.\u00a0 So testing an initial Clustered Index Scan query against that table showed me an estimated IO of 0.1075694 in SQL Server 2012 versus 0.120162 for SQL Azure.\u00a0 So assuming one random I\/O and the rest sequential, I see that my SQL Azure cost is still calculated the same for the Clustered Index Scan:<\/p>\n

— Random I\/O – 0.003125
\n— Sequential – 0.000740741
\nSELECT\u00a0\u00a0\u00a0 0.003125 +
\n0.000740741 * (159-1);<\/p>\n

So the key will be to make sure I\u2019m looking at true apples-to-apples comparisons here.\u00a0 I\u2019ll be testing when I have a few spare moments between other tasks – but in the meantime I\u2019m very interested to learn more about what new changes will come in to SQL Azure in the future.\u00a0 I\u2019ll share anything interesting I find on the blog \u2013 and if you find noteworthy QO items, please share on the comments of this blog as well.<\/p>\n

Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"

I\u2019ve been interested in exploring what changes may be coming through in SQL Azure (Windows Azure \u2013 \u201cSQL Database\u201d now) around query execution cost models and cardinality estimates being fed to them.\u00a0 This was motivated by a couple of things\u2026 First of all, I saw a blog post from Grant Fritchey where he noticed that […]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,22,14],"tags":[],"class_list":["post-478","post","type-post","status-publish","format-standard","hentry","category-cardinality-estimation","category-execution-plan","category-azure"],"yoast_head":"\nWhat Does the Future Hold for Cardinality Estimates and Cost Models in Windows Azure SQL Database? - Joe Sack<\/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\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What Does the Future Hold for Cardinality Estimates and Cost Models in Windows Azure SQL Database? - Joe Sack\" \/>\n<meta property=\"og:description\" content=\"I\u2019ve been interested in exploring what changes may be coming through in SQL Azure (Windows Azure \u2013 \u201cSQL Database\u201d now) around query execution cost models and cardinality estimates being fed to them.\u00a0 This was motivated by a couple of things\u2026 First of all, I saw a blog post from Grant Fritchey where he noticed that […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/\" \/>\n<meta property=\"og:site_name\" content=\"Joe Sack\" \/>\n<meta property=\"article:published_time\" content=\"2012-09-11T11:05:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-12-30T03:16:08+00:00\" \/>\n<meta name=\"author\" content=\"Joseph Sack\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Joseph Sack\" \/>\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\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/\",\"name\":\"What Does the Future Hold for Cardinality Estimates and Cost Models in Windows Azure SQL Database? - Joe Sack\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/#website\"},\"datePublished\":\"2012-09-11T11:05:05+00:00\",\"dateModified\":\"2013-12-30T03:16:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/533eb0113a15fb5a6e8067a49e4ae648\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cardinality Estimation\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/category\/cardinality-estimation\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"What Does the Future Hold for Cardinality Estimates and Cost Models in Windows Azure SQL Database?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/\",\"name\":\"Joe Sack\",\"description\":\"SQL Server Performance Tuning, High Availability and Disaster Recovery Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/533eb0113a15fb5a6e8067a49e4ae648\",\"name\":\"Joseph Sack\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a4b39a7719a6bfff1add3ec00527810734579ee114d6d983e8e68f937b77be96?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a4b39a7719a6bfff1add3ec00527810734579ee114d6d983e8e68f937b77be96?s=96&d=mm&r=g\",\"caption\":\"Joseph Sack\"},\"description\":\"Joe Sack is a Principal Consultant with SQLskills. He has worked as a SQL Server professional since 1997 and has supported and developed for SQL Server environments in financial services, IT consulting, manufacturing, retail and the real estate industry. Prior to joining SQLskills he worked at Microsoft as a Premier Field Engineer supporting very large enterprise customer environments. He was responsible for providing deep SQL Server advisory services, training, troubleshooting and ongoing solutions guidance. His areas of expertise include performance tuning, scalability, T-SQL development and high-availability. In 2006 Joe earned the \u201cMicrosoft Certified Master: SQL Server 2005\u201d certification and in 2008 he earned the \u201cMicrosoft Certified Master: SQL Server 2008\u201d certification. In 2009 he took over responsibility for the entire SQL Server Microsoft Certified Master program and held that post until 2011. He was given the SQL Server MVP award in 2013.\",\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/joe\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/josephsack\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/joe\/author\/joe\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What Does the Future Hold for Cardinality Estimates and Cost Models in Windows Azure SQL Database? - Joe Sack","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\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/","og_locale":"en_US","og_type":"article","og_title":"What Does the Future Hold for Cardinality Estimates and Cost Models in Windows Azure SQL Database? - Joe Sack","og_description":"I\u2019ve been interested in exploring what changes may be coming through in SQL Azure (Windows Azure \u2013 \u201cSQL Database\u201d now) around query execution cost models and cardinality estimates being fed to them.\u00a0 This was motivated by a couple of things\u2026 First of all, I saw a blog post from Grant Fritchey where he noticed that […]","og_url":"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/","og_site_name":"Joe Sack","article_published_time":"2012-09-11T11:05:05+00:00","article_modified_time":"2013-12-30T03:16:08+00:00","author":"Joseph Sack","twitter_misc":{"Written by":"Joseph Sack","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/","url":"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/","name":"What Does the Future Hold for Cardinality Estimates and Cost Models in Windows Azure SQL Database? - Joe Sack","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/#website"},"datePublished":"2012-09-11T11:05:05+00:00","dateModified":"2013-12-30T03:16:08+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/533eb0113a15fb5a6e8067a49e4ae648"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/what-does-the-future-hold-for-cardinality-estimates-and-cost-models-in-windows-azure-sql-database\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/joe\/"},{"@type":"ListItem","position":2,"name":"Cardinality Estimation","item":"https:\/\/www.sqlskills.com\/blogs\/joe\/category\/cardinality-estimation\/"},{"@type":"ListItem","position":3,"name":"What Does the Future Hold for Cardinality Estimates and Cost Models in Windows Azure SQL Database?"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/joe\/","name":"Joe Sack","description":"SQL Server Performance Tuning, High Availability and Disaster Recovery Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/joe\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/533eb0113a15fb5a6e8067a49e4ae648","name":"Joseph Sack","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/joe\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a4b39a7719a6bfff1add3ec00527810734579ee114d6d983e8e68f937b77be96?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a4b39a7719a6bfff1add3ec00527810734579ee114d6d983e8e68f937b77be96?s=96&d=mm&r=g","caption":"Joseph Sack"},"description":"Joe Sack is a Principal Consultant with SQLskills. He has worked as a SQL Server professional since 1997 and has supported and developed for SQL Server environments in financial services, IT consulting, manufacturing, retail and the real estate industry. Prior to joining SQLskills he worked at Microsoft as a Premier Field Engineer supporting very large enterprise customer environments. He was responsible for providing deep SQL Server advisory services, training, troubleshooting and ongoing solutions guidance. His areas of expertise include performance tuning, scalability, T-SQL development and high-availability. In 2006 Joe earned the \u201cMicrosoft Certified Master: SQL Server 2005\u201d certification and in 2008 he earned the \u201cMicrosoft Certified Master: SQL Server 2008\u201d certification. In 2009 he took over responsibility for the entire SQL Server Microsoft Certified Master program and held that post until 2011. He was given the SQL Server MVP award in 2013.","sameAs":["http:\/\/3.209.169.194\/blogs\/joe","https:\/\/twitter.com\/https:\/\/twitter.com\/josephsack"],"url":"https:\/\/www.sqlskills.com\/blogs\/joe\/author\/joe\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/posts\/478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/comments?post=478"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/posts\/478\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/media?parent=478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/categories?post=478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/joe\/wp-json\/wp\/v2\/tags?post=478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}