{"id":80,"date":"2008-06-26T22:48:49","date_gmt":"2008-06-26T20:48:49","guid":{"rendered":"https:\/\/www.sqlinthewild.co.za\/?p=80"},"modified":"2008-06-26T22:48:49","modified_gmt":"2008-06-26T20:48:49","slug":"sql-2008-more-impressions","status":"publish","type":"post","link":"https:\/\/www.sqlinthewild.co.za\/index.php\/2008\/06\/26\/sql-2008-more-impressions\/","title":{"rendered":"SQL 2008 &#8211; More impressions"},"content":{"rendered":"<p>I spent a little more time playing with SQL 2008 this week, though not as much time as I would have liked. I took a look at filtered indexes and some enhancements and changes around the display of the execution plans in Management Studio.<\/p>\n<p><strong>Filtered indexes<\/strong><\/p>\n<p><a href=\"https:\/\/www.sqlinthewild.co.za\/images\/FilteredIndex.PNG\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.sqlinthewild.co.za\/images\/FilteredIndex.PNG\" alt=\"\" width=\"219\" height=\"196\" \/><\/a><\/p>\n<p>These are an interesting feature. There are many uses for these in larger systems and on larger tables. Normally an index is built over an entire table. With a filtered index, one or more predicates is specified when the index is created and the index only contains data that satisfies the predicates. The columns involved in the predicate do not have to be part of the index key, or the index include columns.<\/p>\n<p><!--more-->A use I can see for this is a history table, where many months of data is stored within the table, but only the current month&#8217;s data is extensively queried. Previously any index had to be created over the entire table, potentially including lots of rows that would never be queried. Now, the indexes can be created only on the activly queried portion of the table, reducing the size of the index tree and the space taken on disk<\/p>\n<p>I need to do some investigation on how well the optimiser can match queries to filtered indexes. Expect more written on that point in the future.<\/p>\n<p><strong>Execution plan<\/strong><\/p>\n<p>There have been some interesting and useful changes in how the execution plan is displayed in management studio.<\/p>\n<p>I say displayed, because the structure of the XML plan has not changed from SQL 2005. The XML Schema definition is the same and SQL 2005&#8217;s management studio can read and display an execution plan. This is good in one sence, in that xpath queries that were developed for the 2005 showplan format will still work in SQL 2008. On the other hand, it means that the new 2008 features (sparse columns, filtered indexes) won&#8217;t be flagged as such in the execution plans.<\/p>\n<p>Missing indexes are now flagged in the graphical execution plan.This may or may not be a good thing. It does increase the visibility of the lack of indexes, however the missing index report within an execution plan is just the optimiser&#8217;s quick guess as to what index would have made the query more efficient. There may well be a very similar index already existing. My concern is that this feature will result in lots of useless or near useless indexes created. I suppose it can&#8217;t be worse than no indexes though.<\/p>\n<p><a href=\"https:\/\/www.sqlinthewild.co.za\/images\/Missing Indexes.PNG\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.sqlinthewild.co.za\/images\/Missing Indexes.PNG\" alt=\"\" width=\"460\" height=\"70\" \/><\/a><\/p>\n<p>The execution plan now shows the number of executions that occurred for a particular operator, as well as the number that was estimated. This has been missing since Query Analyser and I am very glad to see it coming back. Knowing whether the sort executed once or a thousand times does really help in identifying the cause of slowness.<\/p>\n<p><a href=\"https:\/\/www.sqlinthewild.co.za\/images\/ExecPlan.PNG\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.sqlinthewild.co.za\/images\/ExecPlan.PNG\" alt=\"\" width=\"183\" height=\"196\" \/><\/a><\/p>\n<p>More 2008 stuff probably next week. If I get a chance to play, that is.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I spent a little more time playing with SQL 2008 this week, though not as much time as I would have liked. I took a look at filtered indexes and some enhancements and changes around the display of the execution&#8230; <a class=\"read-more-button\" href=\"https:\/\/www.sqlinthewild.co.za\/index.php\/2008\/06\/26\/sql-2008-more-impressions\/\">(Read more)<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[15],"tags":[26],"class_list":["post-80","post","type-post","status-publish","format-standard","hentry","category-sql-server","tag-26"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7h6n-1i","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/posts\/80","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/comments?post=80"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/posts\/80\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/media?parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/categories?post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlinthewild.co.za\/index.php\/wp-json\/wp\/v2\/tags?post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}