<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.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>Search results matching tag 'Trace'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=Trace&amp;orTags=0</link><description>Search results matching tag 'Trace'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Express Edition revisited, focus on SSMS</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2013/01/30/express-edition-revisited-focus-on-ssms.aspx</link><pubDate>Wed, 30 Jan 2013 17:01:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47398</guid><dc:creator>TiborKaraszi</dc:creator><description>&lt;p&gt;&amp;nbsp;(Note: I have re-written parts of this post in the light of the comments that SP1 of 2012 include Complete tools.)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I have decided to revisit the topic of whats included in Express Edition, with focus on the tools. I have a couple of reasons for this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In my &lt;a href="http://sqlblog.com/blogs/tibor_karaszi/archive/2011/02/10/what-does-this-express-edition-look-like-anyhow.aspx"&gt;2011 post&lt;/a&gt;, I never tried to connect from Express SSMS to a non-Express database engine.&lt;/li&gt;

&lt;li&gt;I want to check if there are any significant differences in SQL Server 2012 Express Edition, compared to SQL Server 2008R2 Express Edition.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It isn't uncommon that people want to have SQL Server Management Studio (SSMS) on their machines; and instead of searching for the install files for the full product, they download the freely available Express Edition and install SSMS from there. This was the main reason for this update post, and the reason I focus on SSMS and the tools&amp;nbsp;in this post.&lt;/p&gt;

&lt;p&gt;It turns out that both 2008R2 and 2012 RTM Express editions of SSMS includes a lot, but not quite everyting that the full version of SSMS has. And they don't have Profiler or Database Engine Tuning Advisor. 2012 SP1 Express download does indeed have the Complete tool package.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic and Complete&lt;/strong&gt;&lt;br&gt;The full SSMS (etc.) is referred to as "Management Tools - Complete". This is only available with the Product you pay for and with 2012 SP1 Express. The only one available with the various free Express downloads (prior to 2012 SP1), is called "Management Tools - Basic". You can explicitly request to install Basic from an install media that includes Complete, but you have to explicitly request that in the setup program. You don't want to do that. &lt;/p&gt;

&lt;p&gt;One difference between 2008R2 and 2012 is when you install from a pay-media and select that you want to install Express. For 2008R2, you then only have SSMS Basic available. For 2012, you have Complete. In other words, if you use a 2012 pay-media and select Express to install SSMS, you have the option to have the full-blown SSMS - Complete&amp;nbsp;(including other tools, like Profiler).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The downloads&lt;/strong&gt;&lt;br&gt;For SQL Server 2008R2, you have "Express Edition" and "Express Edition with Advanced Services". The former is basically only the database engine, where the later has some Tools (SSMS Basic, primarily). See my earlier blog post for more details about 2008R2. &lt;/p&gt;

&lt;p&gt;For 2012, there are bunch of downloads available. Note that if you want Complete tools, you need to download SP1&amp;nbsp;of the installers. You find SP1 &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=35579"&gt;here&lt;/a&gt; (and RTM, which you don't want to use,&amp;nbsp;&lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=29062"&gt;here&lt;/a&gt;). SP1 includes Complete tools, and you will see that those downloads are significantly larger compared to RTM. It isn't obvious what each exe files stand for, but scroll down and you will find pretty good explanations. I tried several of these (SSMS only, Express with Tools, Express with Advanced Services). They all have in common that for &lt;strong&gt;RTM&lt;/strong&gt; the tool included is &lt;strong&gt;Basic&lt;/strong&gt;, where for &lt;strong&gt;SP1&lt;/strong&gt; we have &lt;strong&gt;Complete&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So what is the difference between Basic and Complete?&lt;/p&gt;

&lt;p&gt;In the table below, my focus was on what&lt;strong&gt; isn't&lt;/strong&gt; in Basic. In general, I don't bother to list functionality which is available in both Basic and Complete. So, if the functionality isn't in the table below, it is likely available in Basic. I might have missed something, of course! And my main focus was on SSMS and the database engine.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;table id="Table1" cellspacing="1" cellpadding="1"&gt;
  
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;Component/Functionality&lt;/b&gt;&lt;/td&gt;

&lt;td&gt;&lt;b&gt;2008R2&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;2012 RTM&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;2012 SP1&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;Functionality in SSMS&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Node for Agent&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Graphical Execution Plans&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Projects and Solutions&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Maint Plans, Wizard&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Maint Plans, New, designer&lt;/td&gt;
&lt;td&gt;N (1)&lt;/td&gt;
&lt;td&gt;N (2)&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Maint Plans, Modify&lt;/td&gt;
&lt;td&gt;N (1)&lt;/td&gt;
&lt;td&gt;N (2)&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Node for SSIS Catalog&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Tools menu, Profiler&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Tools menu, Tuning Advisor&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;Connect Object Explorer to:&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
 
&lt;tr&gt;
&lt;td&gt;Analysis Services&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Reporting Services&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Integration Services&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;Tools&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Profiler&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
  
&lt;tr&gt;
&lt;td&gt;Database Engine Tuning Advisor&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;N&lt;/td&gt;
&lt;td&gt;Y&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;(1): The selections are there, but they were dead - nothing happened when you select them.&lt;br&gt;(2): The selections are there, but I got an error message when selecting any of them.&lt;/p&gt;</description></item><item><title>Using Qure Workload Optimizer for SQL Sentry</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/04/21/using-qure-workload-optimizer-for-sql-sentry.aspx</link><pubDate>Thu, 21 Apr 2011 11:50:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:35067</guid><dc:creator>AaronBertrand</dc:creator><description>		
&lt;p&gt;Last week at &lt;a href="http://www.sqlbits.com/" title="http://www.sqlbits.com/" target="_blank"&gt;SQL Bits #8&lt;/a&gt; in Brighton, England, &lt;a href="http://sqlsentry.net/" title="http://sqlsentry.net/" target="_blank"&gt;SQL Sentry&lt;/a&gt; (my employer) announced its partnership with &lt;a href="http://dbsophic.com/" title="http://dbsophic.com/" target="_blank"&gt;DBSophic&lt;/a&gt;, makers of the Qure workload management suite. Qure Workload Optimizer is a tool aimed at analyzing a workload and providing suggestions to improve the overall performance of that workload. These suggestions can range from adding and dropping indexes, to changing schema, to completely re-writing queries and batches.  How does Qure differ from other products out there aimed at improving performance? Qure works against a copy of your production database, makes actual changes, and tests the workload against those changes to make sure they lead to better performance - leading to the absolute best recommendations that have actually been proven to improve your workload. If you aren' already excited about the potential here, I suggest you read this paragraph again. :-)
        
&lt;/p&gt;

&lt;p&gt;You can read more about the partnership in &lt;a href="http://www.prnewswire.com/news-releases/sql-sentry-partners-with-dbsophic-power-suite--qure-quick-start-pack-announced-119393174.html" title="http://www.prnewswire.com/news-releases/sql-sentry-partners-with-dbsophic-power-suite--qure-quick-start-pack-announced-119393174.html" target="_blank"&gt;this press release from April 7th&lt;/a&gt; and also in the following blog post by Greg Gonzalez (&lt;a href="http://twitter.com/SQLsensei" title="@SQLsensei"&gt;twitter&lt;/a&gt;): &lt;a href="http://greg.blogs.sqlsentry.net/2011/04/sql-sentry-v61-something-old-several.html" target="_blank"&gt;SQL Sentry v6.1: Something Old, Several Things New&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
 
&lt;p&gt;The way that the base Qure product currently works is as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;on the production server, you create a trace using a template provided by DBSophic, preferably covering a complete business cycle;&lt;br&gt;&lt;/li&gt;

&lt;li&gt;on a server dedicated for the analysis, you restore a backup of the production database;&lt;/li&gt;

&lt;li&gt;once your trace is complete, you point Qure at the trace files (or table) and to the backup of the database, and run the analysis.&lt;br&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the bundled version created exclusively for SQL Sentry, you bypass step 1 and simply point Qure at the SQL Sentry v6 repository that has been monitoring your server. So instead of having to set up a trace and run it yourself, you can use what SQL Sentry is already doing for you. Note that this is limited to the last 100,000 trace events, but will also include up to the last 100,000 QuickTrace events as well - so if you have been running QuickTraces on your server, this data will be factored in as well.
&lt;/p&gt;

&lt;p&gt;Before starting, it's a good idea to have SQL Sentry cover a complete business cycle with the "Top SQL" duration threshold tuned down to something lower than the default (5 seconds). Essentially you want to include as many events as possible; this way, the impact of any recommended changes can truly be tested.  Even if an operation currently only takes 2 seconds, a change to benefit some other query might adversely affect some of these shorter queries.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;That said, here is a step-by-step flow of how this works. (Click on any screen shot to show full size.)
&lt;/p&gt;

&lt;p&gt;When you launch the program, you will see the splash screen looks a little bit different:&lt;br&gt;&lt;/p&gt;



&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo01.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo01.png" alt="Qure Workload Optimizer for SQL Sentry splash screen" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Qure Workload Optimizer for SQL Sentry splash screen&lt;/font&gt;&lt;/blockquote&gt;

&lt;p&gt;Next, you'll choose "Start New Analysis" and you will be asked if you want to perform a full analysis or a trial analysis. For our purposes here, let's use a trial analysis. This will mean a limited set of recommendations will be provided (but I will show the results of a fully licensed analysis).&amp;nbsp; &lt;br&gt;&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo02.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo02.png" alt="Selecting a trial analysis" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Selecting a trial analysis&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;Next, you will be asked where you want to store the analysis file. By default this will go under the Qure folder in My Documents, but be aware that this file can be up to 4GB - so if your C:\ drive is getting skinny, you may want to choose a different location: &lt;br&gt;&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo03.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo03.png" alt="Selecting a location for the analysis file" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Selecting a location for the analysis file&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;You will then be asked for the server where your database has been restored. There is an additional warning here that you should not be performing the analysis against a production database (and I strongly recommend you heed this warning). Please make sure this is a *COPY* of your production database and that the server is not a production server. I feel like I'm repeating myself, but it is &lt;b&gt;*extremely important*&lt;/b&gt; to avoid running such an analysis against your production environment.  The reason is that changes are made to the database in order to validate the recommendations being made will, in fact, improve performance.&lt;br&gt;&lt;/p&gt;


&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo04.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo04.png" alt="Selecting the server that holds a *copy* of your production database" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Selecting the server that holds a *copy* of your production database&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;Once you connect to a server, Qure will ask you which database(s) you want to analyze. You can select more than one (for a full analysis, you can select three; for a trial analysis, two), but in this case we will just select a single database: &lt;br&gt;&lt;/p&gt;


&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo05.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo05.png" alt="Selecting the database(s) to analyze" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Selecting the database(s) to analyze&lt;/font&gt;&lt;/blockquote&gt;

&lt;p&gt;The next screen asks you for your trace sources. In the base product, you can select any number of trace files, trace tables, or both, but in this custom version of Qure, you go down to Add Trace &amp;gt; Add SQL Sentry Trace: &lt;br&gt;&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo06.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo06.png" alt="Adding a SQL Sentry Trace" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Adding a SQL Sentry Trace&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;You will then be asked to point to the SQL Sentry v6 repository, where Qure will analyze the trace data that has already been collected: &lt;br&gt;&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo07.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo07.png" alt="Selecting the SQL Sentry v6 repository" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Selecting the SQL Sentry v6 repository&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;On the next screen, there are a couple of options to consider. One that I strongly recommend you select is the option to "Keep all existing indexes." The reason is this: no matter how long you have been collecting trace data or performance metrics, there is always the chance that an index you or software thinks is unnecessary will actually be needed tomorrow. My official advice here is to never drop an index unless you are absolutely sure it is redundant or no longer needed - and never let software do this automatically. Fellow MVP Paul Randal (&lt;a href="http://twitter.com/PaulRandal" target="_blank"&gt;twitter&lt;/a&gt;) recently &lt;a href="http://www.sqlskills.com/BLOGS/PAUL/post/Beware-of-advice-from-3rd-party-tools-around-indexes.aspx" target="_blank"&gt;published a horror story&lt;/a&gt; about a tool that recommended dropping "redundant" indexes without knowing the whole story (and failing to recognize the attributes that made the indexes different). 
&lt;/p&gt;

&lt;p&gt;On the other hand, if you want to see what redundant indexes may be suggested by the tool, it is safe to leave this option unchecked. (Since it knows the workload may not represent a full business cycle, Qure Workload Optimizer will not, in fact, recommend dropping indexes based on use or lack of use - it will only recommend dropping duplicate, redundant, hypothetical or disabled indexes. The "Keep all existing indexes" checkbox here dictates whether redundant indexes are considered - all others will still recommend to be dropped.) When you need to be careful is when you get to the point of applying the recommendations, that you review that involve dropping indexes, and be sure that you want to accept those individual changes (you can easily reject any single recommendation).
&lt;br&gt;&lt;/p&gt;


&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo09.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo09.png" alt="Analysis settings screen" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Analysis settings screen&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;The next screen is just a summary; you can click the Start Analysis button to get things going:&lt;br&gt;&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo10.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo10.png" alt="Summary / Start Analysis screen" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Summary / Start Analysis screen&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;You can watch the process as it analyzes the server, database(s) and individual objects, and comes up with recommendations: &lt;br&gt;&lt;/p&gt;


&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo11.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo11.png" alt="Generating recommendations..." border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Generating recommendations...&lt;/font&gt;&lt;/blockquote&gt;

&lt;p&gt;You will also see it perform a banchmark analysis, testing the performance before and after the recommendations are applied (don't worry, these changes are reverted):
&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo12.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo12.png" alt="Benchmarking..." border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Benchmarking...&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;Once finished, you will arrive at a success dialog:
&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo13.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo13.png" alt="Summary / View Report screen" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Summary / View Report screen&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;When you click "View Report," you will be shown a screen which summarizes the recommendations. From here you can get a very quick view of the top batch improvements and how the improvements are measured (duration, I/O, CPU, or some combination):
&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo14.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo14.png" alt="Top Improved Batches" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Top Improved Batches&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;
If you scroll down on that same dialog, you can expand the "Recommendation Summary" to see a high-level view of what types of recommendations are being made, and what kind of impact they will have. Note that not all recommendations are deemed "applicable" - those that are applicable can be applied with minimal risk to behavior, and through scripts generated by Qure Workload Optimizer. The remaining recommendations are provided for guidance and will not be applied automatically - they should still be reviewed, as we'll see on upcoming screens.&lt;br&gt;&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo15.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo15.png" alt="Recommendation Summary" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Recommendation Summary&lt;/font&gt;&lt;/blockquote&gt;

&lt;p&gt;If you switch to the Batches tab, you can see exactly how the recommended changes will affect each batch in terms of the overall workload - be it duration, physical or logical reads, writes, or CPU. You can sort here to focus on the batches with improvements in your area(s) of largest concern, for example if your system is very I/O-bound, you may want to focus on the changes with the greatest improvements in I/O, so sort by the physical reads column.  Note that you may see cases where some attributes were affected negatively (e.g. physical reads went up), but overall duration went down. You can select individual or multiple batches here, or even select all to see the total impact of all recommended changes.&lt;br&gt;&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo16c.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo16c.png" alt="Optimization Result - Performance" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Optimization Result - Performance&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;Next, you can move to the Recommendations tab. Here you can review all of the possible changes, and indicate which you want to test by highlighting them and clicking "Accept." Note that the following screen shot shows several recommendations that require manual rewrites of batches; you can't apply these directly to the database, since these were ad hoc queries submitted to SQL Server. But it can give you a good idea about how to improve the code you're sending that way... the example I've pointed out is actually part of my "&lt;a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/16/bad-habits-to-kick-mishandling-date-range-queries.aspx" target="_blank"&gt;Mishandling Date Range Queries&lt;/a&gt;" set of bad T-SQL habits to kick - applying a function to a column in a search predicate, preventing the use of an index.&lt;br&gt;&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo17.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo17.png" alt="Recommendations - Script Review" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Recommendations - Script Review&lt;/font&gt;&lt;/blockquote&gt;

&lt;p&gt;You can change the filters on the left to highlight specific recommendations; once you have chosen which recommendations to accept, you can move to the Optimize tab, which will guide you through applying the changes (again, only to a &lt;b&gt;*copy*&lt;/b&gt; of your production database). When you are happy with the changes you are about to apply, press the "Start Optimization" button:
&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo19.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo19.png" alt="Optimize screen" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Optimize screen&lt;/font&gt;&lt;/blockquote&gt;

&lt;p&gt;This will start the "Apply Recommendations Wizard" - which again has sensible warnings about not applying these changes to production databases: &lt;br&gt;&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo20.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo20.png" alt="Apply Recommendations Wizard" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Apply Recommendations Wizard&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;You will be asked again for the connection details of the copy / test database, and then you can choose "Start Applying": &lt;br&gt;&lt;/p&gt;


&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo21.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo21.png" alt="Select *copy* of production database to affect" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Select *copy* of production database to affect&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;When finished, you will see the following dialog (but don't forget that there are several changes Qure Workload Optimizer recommended but couldn't make automatically, such as changes to batches that are issued ad hoc or from applications): &lt;br&gt;&lt;/p&gt;

&lt;blockquote style="padding-left:25px;"&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2011/04/qo22.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/04/qo22.png" alt="Success dialog" border="0" height="384" width="516"&gt;&lt;/a&gt;&lt;br&gt;&lt;font color="#999999" size="1"&gt;Success dialog&lt;/font&gt;&lt;/blockquote&gt;


&lt;p&gt;Now you can test your changes in your test or QA server(s) and deem whether they are satisfactory for migration to your production environment. You can watch the newly changed database(s) on the test / QA server with SQL Sentry v6, run applicable workloads against the test server, and you should find a dramatic improvement in performance.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Once again, as a reminder, please be sure to thoroughly test changes suggested by any person or piece of software, especially in cases where the whole story may not be known - for example, if your collection has not covered a complete business cycle, or if you have filtered out a large number of individual events. A suggestion can only be as good as the information it's based on.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;So if you are looking for a reliable and effective way to improve performance of your applications, you should absolutely consider taking Qure + SQL Sentry for a test drive! The software will be available for download soon. In the meantime, if you're not already using SQL Sentry, you can register for a trial download at &lt;a href="http://www.sqlsentry.net/download-trial/trial.asp" title="http://www.sqlsentry.net/download-trial/trial.asp" target="_blank"&gt;http://www.sqlsentry.net/download-trial/trial.asp&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp; &lt;br&gt;&lt;/p&gt;</description></item><item><title>Connect digest : 2009-06-20</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2009/06/20/connect-digest-2009-06-20.aspx</link><pubDate>Sat, 20 Jun 2009 15:11:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14790</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;Here are the Connect items I'd like to draw your attention to this week.&amp;nbsp; I have abandoned the idea of trying to keep track of vote counts and overall rating.&amp;nbsp; Being lazy might be a small part of it, but it is mostly because I just don't think it makes sense to assume that my postings are all that influence Connect behavior.&amp;nbsp; I know I have some impact on the visibility of certain items, but I'm going to leave it at that.&lt;/p&gt;&lt;p&gt;==================================== &lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;SQL Server 2008 connection pooling problems&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Something to watch out for if you are using connection pooling and SQL Server 2008:&lt;/p&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=468478" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=468478" target="_blank"&gt;#468478 : SQL Server 2008 Periodically Does Not Accept Connections&lt;/a&gt;&lt;br&gt;&lt;p&gt;====================================&lt;/p&gt;&lt;p&gt;&lt;b&gt;Statistics on partitions&lt;/b&gt;&lt;/p&gt;&lt;p&gt;As partitioning becomes more of a viable and beneficial option, new requirements are creeping out of the woodwork, such as the ability to update statistics per partition instead of for the entire object:&lt;br&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=468517" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=468517" target="_blank"&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=468517" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=468517" target="_blank"&gt;#468517 : Update Statistics at the partition level&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;==================================== &lt;br&gt;
&lt;/p&gt;&lt;p&gt;&lt;b&gt;DBCC SHRINKFILE() flexibility &lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;While personally I think the need is not all that dire, some people want to be able to shrink a database file to a size smaller than the original allocation (which is currently prevented by SQL Server).&amp;nbsp; Joe Sack made the request formal:&lt;/p&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=467285" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=467285" target="_blank"&gt;#467285 : Shrink files beneath originally allocated space&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;==================================== &lt;/p&gt;&lt;p&gt;&lt;b&gt;Distributed transactions&lt;/b&gt; &lt;br&gt;&lt;/p&gt;&lt;p&gt;Erland has filed a couple of interesting issues regarding distributed transactions:&lt;/p&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=466739" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=466739" target="_blank"&gt;#466739 : There should be a system function to tell whether the current transaction is a distributed transaction&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=466749" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=466749" target="_blank"&gt;#466749 : Cannot call stored procedures when a distributed transaction has been rolled back&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;==================================== &lt;/p&gt;&lt;p&gt;&lt;b&gt;Clickable URLs in error messages&lt;/b&gt;&lt;br&gt;&lt;br&gt;Finally, Adam is asking for URLs in the messages pane (e.g. those you could embed in custom messages or ad hoc within RAISERROR) to be clickable.&amp;nbsp; I think it makes a lot of sense, though it is currently resolved as "won't fix"...&lt;/p&gt;&lt;a href="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=454907" title="http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=454907" target="_blank"&gt;#454907 : Make URLs clickable in the SSMS Messages pane &lt;/a&gt;&lt;p&gt;==================================== &lt;/p&gt;&lt;p&gt;Please remember, I am not trying to coerce you to vote for issues you don't care about, just trying to raise awareness for some items that might have slipped under your radar... &lt;br&gt;&lt;/p&gt;</description></item><item><title>Match those types!</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2009/04/28/match-those-types.aspx</link><pubDate>Tue, 28 Apr 2009 10:30:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:13606</guid><dc:creator>TiborKaraszi</dc:creator><description>&lt;P&gt;This is a recommendation I believe is worth repeating from time to time: Make sure you match data types when you write TSQL code. Else you in most cases end up with an implicit data type conversion. And in worst case, this conversion is performed at the column side - not the literal side of your query. What does that mean? Consider below:&lt;/P&gt;
&lt;P&gt;WHERE Col = Val&lt;/P&gt;
&lt;P&gt;Now, say that the types for above don't match. Val might be some parameter (to a stored procedure, for instance), a variable or a written value (literal). In any case, when SQL Server need to do some operation )like comparison like here) involving several values which aren't of the same type, then one of the values need to be converted so it is of the same type as the other. Which one is determined by the rules for "&lt;A title='Data Type Precendence"' href="http://msdn.microsoft.com/en-us/library/ms190309.aspx"&gt;Data Type Precedence&lt;/A&gt;". &lt;/P&gt;
&lt;P&gt;What we don't want is a conversion at the column side. Why? I would argue that an implicit conversion in the first place in many cases mean I misunderstood something about the types in my system and am on my way of producing a bug in my code. But having a more strict language is not the topic for this particular post (check out &lt;A title=this href="http://sommarskog.se/wishlist.html#strictchecks"&gt;this&lt;/A&gt;). My point here is that it is bad for performance reasons. Just yesterday and today I was &lt;A title="involved in a thread" href="http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/76f22f8a-53b1-4a30-a741-14da5cf539f1/"&gt;involved in a thread&lt;/A&gt; on the MSDN forum. Here's the repro script from that thread (slightly adjusted by me):&lt;/P&gt;
&lt;P&gt;&lt;CODE style="FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:blue;"&gt;USE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;tempdb &lt;BR&gt;GO &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;IF&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:magenta;"&gt;OBJECT_ID&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'t'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;IS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;NOT&amp;nbsp;NULL&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;DROP&amp;nbsp;TABLE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t &lt;BR&gt;GO &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;CREATE&amp;nbsp;TABLE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;( &lt;BR&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c1&amp;nbsp;int&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:#434343;"&gt;IDENTITY&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;10000001&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&amp;nbsp;NOT&amp;nbsp;NULL&amp;nbsp; &lt;BR&gt;,&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;8&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&amp;nbsp;NULL &lt;BR&gt;,&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c3&amp;nbsp;datetime&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;NULL &lt;BR&gt;) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;GO &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;INSERT&amp;nbsp;INTO&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c3&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&amp;nbsp; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;TOP &lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;3000000&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'20080203'&amp;nbsp; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;master..spt_values&amp;nbsp;t1 &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;CROSS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;master..spt_values&amp;nbsp;t2 &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;CROSS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;JOIN&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;master..spt_values&amp;nbsp;t3 &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;UPDATE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SET&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:magenta;"&gt;CAST&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c1&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;AS&amp;nbsp;char&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;8&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;CREATE&amp;nbsp;UNIQUE&amp;nbsp;CLUSTERED INDEX&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;x&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ON&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;GO &lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'10000009' &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;N'10000008'&lt;/SPAN&gt;&lt;/CODE&gt; &lt;/P&gt;
&lt;P&gt;Don't bother too much about the first section. The relevant part here is that we have char(8) column with values which are unique (enforced by a unique index), on a table with three million rows.&lt;/P&gt;
&lt;P&gt;Now, before we dig deeper: What is the problem with above queries? The type do not match! The type in the table is char(8), but&amp;nbsp;literal is Unicode (the N before the string). Since nchar has higher precedence than char, then the column side needs to be converted to the value side. Not good. Try the code on SQL Server 2000 and you will see disaster. For me, STATISTICS IO gave 10755 logical reads for both queries, with Clustered Index Scan (which is the same as table scan). Hoover on the Clustered Index Scan icon and you will find "WHERE:(Convert([t].[c2])=[@1])". See how the conversion is done at the column side? This, my friend, mean that SQL Server cannot seek an index to find the rows. Ouch! That's just because we were a bit sloppy... Compare to below:&lt;/P&gt;&lt;CODE style="FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'10000009' &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;*&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;c2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'10000008'&lt;/SPAN&gt;&lt;/CODE&gt; 
&lt;P&gt;You will find for both two above we have Clustered Index Seek with only three logical reads. That is a good improvement.&lt;/P&gt;
&lt;P&gt;OK, enough about SQL Server 2000, lets discuss 2008/2005. At first I couldn't see any difference between the two original queries (N'10000009' and N'10000008'). Both seemed to be instant, and the same execution plan for both. I even saved the execution plan as XML and used WinDiff to compare the xml files. No difference. But the poster said the "9" query was slower than the "8" query. I executed to text and had ctrl-E pressed for a while. And now I could see a difference. The flicker was quicker for the "8" version vs. the "9" version. I used Profiler and confirmed. The "9" version had consistently about 90000 microsecond duration where the "8" version had about 0 duration. This was also reflected in CPU usage, as shown by Profiler. I hoped to use Extended Events to find something deeper about this, but that didn't give me anything. Perhaps I didn't capture the relevant events, quite simply. X/Event experts are welcome to suggest event session configurations. :-)&lt;/P&gt;
&lt;P&gt;My guess for the difference is in the execution plan. You will see an index seek for both. That is good, since SQL Server nowadays potentially can use an index even if you end up with an implicit conversion at the column side. But you will see a few more operators in addition to the index seek. See that Constant Scalar followed by a Compute Scalar? My guess is that the built-in internal function used inside the Compute Scalar operator is more expensive for N'10000009' compared to N'10000008'. You can see this function if you use SET STATISTICS PROFILE ON. See the GetRangeThroughConvert() function. My guess is that the answer is the cost for this function. (Search the Internet for things like "Constant Scan" and "GetRangeThroughConvert" for other blog post on this topic.)&lt;/P&gt;
&lt;P&gt;The moral of the story? Here we have a cost which can be relevant in some cases, but we will only see this if we happen to execute our query with the right values and are very very observant. But we can eliminate all this mess this by using the right type for the column in the first place!&lt;/P&gt;</description></item><item><title>Did we have recent autogrow?</title><link>http://sqlblog.com/blogs/tibor_karaszi/archive/2008/06/19/did-we-have-recent-autogrow.aspx</link><pubDate>Thu, 19 Jun 2008 13:51:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:7390</guid><dc:creator>TiborKaraszi</dc:creator><description>&lt;P&gt;I just read the question how to find out when autogrow in tempdb happened. And again I want to push for the default trace. The simple answer is that you already have this information available, just go and get it! (Unless you explicitly disabled the default trace, of course...)&lt;/P&gt;
&lt;P&gt;Adjust the file name for your most recent default trace file in below query:&lt;/P&gt;&lt;CODE style="FONT-SIZE:12px;"&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;te.name&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t.DatabaseName&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t.FileName&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t.StartTime&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t.ApplicatioNname &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:darkred;"&gt;fn_trace_gettable&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'C:\Program&amp;nbsp;Files\Microsoft&amp;nbsp;SQL&amp;nbsp;Server\MSSQL.3\MSSQL\LOG\log_331.trc'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;,&amp;nbsp;NULL)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;INNER&amp;nbsp;JOIN&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;sys.trace_events&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;AS&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;te&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ON&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;t.EventClass&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;te.trace_event_id &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;te.name&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;LIKE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;'%Auto&amp;nbsp;Grow' &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ORDER&amp;nbsp;BY&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:black;"&gt;StartTime&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ASC&lt;/SPAN&gt;&lt;/CODE&gt;</description></item><item><title>Did You Know SQL Server Has A Black Box Like An Airplane?</title><link>http://sqlblog.com/blogs/denis_gobo/archive/2007/06/03/1395.aspx</link><pubDate>Sun, 03 Jun 2007 19:33:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:1395</guid><dc:creator>Denis Gobo</dc:creator><description>Paul Randal writes: 
&lt;BLOCKQUOTE&gt;"Kimberly mentioned that SQL Server has a 'black-box' trace, similar to an aircraft flight-recorder, which I'd never heard of. It's an internal trace that has the last 5MB of various trace events and it's dumped to a file when SQL Server crashes. This can be really useful if you're troubleshooting an issue that causing SQL Server to crash or someone or something is telling SQL Server to shutdown and its unclear who or what is doing it." &lt;/BLOCKQUOTE&gt;Read here how to turn it on: &lt;A href="http://blogs.msdn.com/sqlserverstorageengine/archive/2007/06/03/sql-server-s-black-box.aspx"&gt;http://blogs.msdn.com/sqlserverstorageengine/archive/2007/06/03/sql-server-s-black-box.aspx&lt;/A&gt;</description></item></channel></rss>