<?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 tags 'SQL Server' and 'Performance Tuning'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=SQL+Server,Performance+Tuning&amp;orTags=0</link><description>Search results matching tags 'SQL Server' and 'Performance Tuning'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Performance Monitor and Wait Events Presentation with Quest</title><link>http://sqlblog.com/blogs/buck_woody/archive/2010/07/19/performance-monitor-and-wait-events-presentation-with-quest.aspx</link><pubDate>Mon, 19 Jul 2010 13:41:53 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:27138</guid><dc:creator>BuckWoody</dc:creator><description>&lt;p&gt;Quest Software is a great partner with Microsoft, and I&amp;rsquo;m honored to be able to present with Brent Ozar, Kevin Kline and Ari Weil at a day-long event that you can attend for free. We&amp;rsquo;re going to cover many aspects of performance tuning, from waits and queues to the Windows System Monitor, which you might also know as PerfMon or Performance Monitor. &lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s expensive to go to conferences, so when your boss complains that you&amp;rsquo;ll be gone all day, remind him/her that it&amp;rsquo;s *free*. (Plus, you can tell them I said it&amp;rsquo;s OK. )&lt;/p&gt;
&lt;p&gt;Register here: &lt;span style="font-family:'Calibri', 'sans-serif';font-size:11pt;mso-fareast-font-family:'Times New Roman';mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;&lt;a href="http://www.quest.com/julyvtbwblog"&gt;&lt;span style="mso-bidi-font-family:Calibri;"&gt;&lt;span style="text-decoration:underline;"&gt;&lt;span style="color:#800080;"&gt;www.quest.com/julyvtbwblog&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:'Calibri', 'sans-serif';"&gt;&lt;span style="color:#000000;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>The Windows Page File and SQL Server</title><link>http://sqlblog.com/blogs/buck_woody/archive/2010/06/29/the-windows-page-file-and-sql-server.aspx</link><pubDate>Tue, 29 Jun 2010 13:48:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:26561</guid><dc:creator>BuckWoody</dc:creator><description>&lt;p&gt;What is the best “Page File” size for a Windows system running SQL Server? I see this question over and over – and I see people answering it incorrectly all the time. &lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;&lt;em&gt;Note: I’m talking specifically about 64-bit architectures here. The information is different for 32-bit architectures, but I’ll blog about that at another time.&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;First, let’s start out with defining a few terms. A “Page File” is simply a file on the hard drive that handles situations where the system wants to move (or “page out”) sections of memory. There are several situations that cause this, but the one you’re most concerned about is when the system is out of physical memory. If the system runs out of memory it can “borrow” some storage from the hard drive to release some memory until it needs that data again. &lt;/p&gt;  &lt;p&gt;And that’s exceptionally bad. The reason is that hard drives are amazingly slow in comparison with solid-state memory access. So you REALLY slow down a SQL Server when this happens. In fact, if it happens a lot, that’s a sure sign you need to add more physical RAM.&lt;/p&gt;  &lt;p&gt;When you install Windows in the server flavors, it takes a couple of defaults that aren’t always best. As a rule, it will try to allocate 1.5 times the amount of physical RAM to the pagefile. If you have a lot of RAM, that really isn’t necessary. In some Windows versions, it also has a “system managed page file size”, meaning it will grow the file as it needs to. I normally choose a different size for the page file, and set both the “top” and “bottom” values to be the same. So what &lt;em&gt;is&lt;/em&gt; that size?&lt;/p&gt;  &lt;p&gt;Ah – if only it were that simple. As always, the answer is – wait for it - “it depends”. But this time you’re not left in the dark (completely) about how to find that out. It’s a straightforward matter of monitoring a few counters and adjusting the file as needed. Here are the pertinent counters, from a KB article we have for Windows 2003: &lt;/p&gt;  &lt;p&gt;   &lt;table class="table" cellspacing="1"&gt;       &lt;tr&gt;         &lt;th&gt;Counter threshold&lt;/th&gt;          &lt;th&gt;Suggested value&lt;/th&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;Memory\\Available Bytes&lt;/td&gt;          &lt;td&gt;No less than 4 MB&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;Memory\\Pages Input/sec&lt;/td&gt;          &lt;td&gt;No more than 10 pages&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;Paging File\\% Usage &lt;/td&gt;          &lt;td&gt;No more than 70 percent&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;Paging File\\% Usage Peak &lt;/td&gt;          &lt;td&gt;No more than 70 percent&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;Process\\Page File Bytes Peak&lt;/td&gt;          &lt;td&gt;Not applicable&lt;/td&gt;       &lt;/tr&gt;     &lt;/table&gt; &lt;/p&gt;  &lt;p&gt;DO NOT take my word for this. Read the full article here to understand what you are looking at - &lt;a href="http://support.microsoft.com/kb/889654/en-us"&gt;http://support.microsoft.com/kb/889654/en-us&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;There’s one more thing to keep in mind. The pagefile can also be used for troubleshooting. If you have the “Full Dump” option set on the system settings in Windows, you will need a higher value – the full 1.5 times in some cases. As always, your mileage may vary, so spend some time in that KB and understand what you’re looking at. &lt;/p&gt;  &lt;p&gt;And if you see anyone giving out a hard number for that Page File value, point them here. &lt;/p&gt;</description></item><item><title>Performance-Driven Development</title><link>http://sqlblog.com/blogs/buck_woody/archive/2010/05/11/performance-driven-development.aspx</link><pubDate>Tue, 11 May 2010 13:36:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:25021</guid><dc:creator>BuckWoody</dc:creator><description>&lt;P&gt;I was &lt;A href="http://blogs.msdn.com/sqlazure/archive/2010/05/10/10009232.aspx" target=_blank&gt;reading a blog yesterday about the evils of SELECT *&lt;/A&gt;. The author pointed out that it's almost always a bad idea to use SELECT * for a query, but in the case of SQL Azure (or any cloud database, for that matter) it's especially bad, since you're paying for each transmission that comes down the line. A very good point indeed.&lt;/P&gt;
&lt;P&gt;This got me to thinking - shouldn't we treat ALL programming that way? In other words, wouldn't it make sense to pretend that we are paying for every chunk of data - a little less for a bit, a lot more for a BLOB or VARCHAR(MAX), that sort of thing? In effect, we really are paying for that. Which led me to the thought of Performance-Driven Development, or the act of programming with the goal of having the fastest code from the very outset. This isn't an original title, since a quick Bing-search shows me a couple of offerings from Forrester and a professional in Israel who already used that title, but the general idea I'm thinking of is assigning a "cost" to each code round-trip, be it network, storage, trip time and other variables, and then rewarding the developers that come up with the fastest code.&lt;/P&gt;
&lt;P&gt;I wonder what kind of throughput and round-trip times you could get if your developers were paid on a scale of how fast the application performed...&lt;/P&gt;</description></item><item><title>PowerShell Version Two – Get Continuous Perf Counters</title><link>http://sqlblog.com/blogs/buck_woody/archive/2010/02/25/powershell-version-two-get-continuous-perf-counters.aspx</link><pubDate>Thu, 25 Feb 2010 14:32:52 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:22620</guid><dc:creator>BuckWoody</dc:creator><description>&lt;p&gt;In version 2.0 of PowerShell, you can now use a direct command-let (get-Counter) to get at the Performance Monitor counters. For instance, to show the current value of the Processor Percent Time, use this command:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;span style="color:blue;"&gt;Get-Counter&lt;/span&gt; &lt;span style="color:darkred;"&gt;'\Processor(*)\% Processor Time'&lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;The interesting part of get-Counter is that you can add a parameter at the end to keep sampling:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;span style="color:blue;"&gt;Get-Counter&lt;/span&gt; &lt;span style="color:darkred;"&gt;'\Processor(*)\% Processor Time' - Continuous&lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;Which is very useful if you’re doing performance troubleshooting like I am this morning. And yes, you can use this to get at SQL Server counters as well – to see the entire set of counters, use this command:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;span style="color:blue;"&gt;Get-Counter&lt;/span&gt; &lt;span style="color:navy;"&gt;–listSet&lt;/span&gt; &lt;span style="color:blueviolet;"&gt;*&lt;/span&gt; &lt;span style="color:darkgray;"&gt;|&lt;/span&gt; &lt;span style="color:blue;"&gt;Select-Object&lt;/span&gt; &lt;span style="color:navy;"&gt;-ExpandProperty&lt;/span&gt; &lt;span style="color:blueviolet;"&gt;Paths&lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;" class="MsoNormal"&gt;&lt;font face="Calibri"&gt;&lt;b&gt;&lt;i style="mso-bidi-font-style:normal;"&gt;&lt;span style="color:maroon;font-size:10pt;mso-bidi-font-size:11.0pt;mso-bidi-font-family:calibri;mso-ansi-language:en;"&gt;Script Disclaimer, for people who need to be told this sort of thing: &lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i style="mso-bidi-font-style:normal;"&gt;&lt;span style="color:maroon;font-size:10pt;mso-bidi-font-family:calibri;mso-ansi-language:en;"&gt;           &lt;p&gt;&lt;/p&gt;         &lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style:normal;"&gt;&lt;span style="color:maroon;font-size:10pt;mso-bidi-font-family:calibri;mso-ansi-language:en;"&gt;&lt;font face="Calibri"&gt;Never trust any script, including those that you find here, until you understand exactly what it does and how it will act on your systems. Always check the script on a test system or Virtual Machine, not a production system. All scripts on this site are performed by a professional stunt driver on a closed course. Your mileage may vary. Void where prohibited. Offer good for a limited time only. Keep out of reach of small children. Do not operate heavy machinery while using this script. If you experience blurry vision, indigestion or diarrhea during the operation of this script, see a physician immediately.&lt;/font&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;</description></item><item><title>The SQL Server Health Check</title><link>http://sqlblog.com/blogs/buck_woody/archive/2010/02/11/the-sql-server-health-check.aspx</link><pubDate>Thu, 11 Feb 2010 14:16:05 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:22161</guid><dc:creator>BuckWoody</dc:creator><description>&lt;p&gt;My friend Brent Ozar, who is a top-notch SQL Server Professional, mentioned on his blog (&lt;a href="http://www.brentozar.com/archive/2007/04/sql-server-health-check/comment-page-1/#comment-17520"&gt;http://www.brentozar.com/archive/2007/04/sql-server-health-check/comment-page-1/#comment-17520&lt;/a&gt;) that he brought in Microsoft Support to do a “Health Check”. There were some questions about what this actually entails – so I thought I would post that description here.&lt;/p&gt;  &lt;p&gt;A SQL Server Health Check from Microsoft is an offering provided through our support and consulting branches. If you’ve purchased a Premier support agreement, you can use the hours you pay for to have someone come out and check out your systems using two basic vectors: standard best practices, and the best practices for your environment. Let me explain that a little further.&lt;/p&gt;  &lt;p&gt;Microsoft Consulting Services (MCS) has an advanced set of tools and techniques to reach deep into your systems to evaluate them against a set of criteria that we establish for the best performance, safety and reliability for SQL Server. But your SQL Server Instances will be different than someone else’s, so the consultant will also spend some time in an interview with various teams to find out how you’re using the system. They’ll consult with experts in that area back at Redmond, and at the end of the engagement you get what I feel is the most valuable part of the exercise – the report. The report shows what was done, how it was done, what the findings are and what recommendations the consultant makes. It’s a thing of beauty.&lt;/p&gt;  &lt;p&gt;You don’t have to have a Premier agreement to get a SQL Server Health Check, and companies other than Microsoft have versions of this as well. The prices vary, so if you want a Microsoft person then contact your local Microsoft office and ask for the Consulting Manager for your area. They will get you to the right person and you can work out the costs from there. If you take a hard look, most of the time the cost is well justified.&lt;/p&gt;  &lt;p&gt;On a related note, I think it’s fantastic that Brent has the foresight to bring in “another pair of eyes” on his systems. Brent is actually in the program to gain a SQL Server “Master” certification – something only a few people in the world have. He works for a software development firm that creates fantastic products for – wait for it – SQL Server! He could evaluate his own systems, and of course he does. But he realizes that there’s always something more to learn, and someone out there may know one more little detail that he doesn’t. This is the mark of a very bright person.&lt;/p&gt;</description></item><item><title>Tracking SQL Server Time</title><link>http://sqlblog.com/blogs/buck_woody/archive/2010/01/25/tracking-sql-server-time.aspx</link><pubDate>Mon, 25 Jan 2010 14:10:28 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:21420</guid><dc:creator>BuckWoody</dc:creator><description>&lt;p&gt;In the past few blog posts I’ve showed you how to use several methods to track things in SQL Server. You can use the “tags” to the right of this post here at this site to list things like PowerShell, Performance Tuning and so on. Now that you’re armed with these tools, what should you track?&lt;/p&gt;  &lt;p&gt;Well, one of the items I track is &lt;em&gt;time&lt;/em&gt;. I track the time it takes for lots of things, but they fall into three general buckets:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Queries – Normally I track the five longest running queries with their query plans. &lt;/li&gt;    &lt;li&gt;Maintenance – From how long each backup takes to index reorgs and rebuilds, I want to know how long these things take.&lt;/li&gt;    &lt;li&gt;Jobs – Most all of us have SQL Server Agent Jobs, and developing a schedule of how long they are running is very useful.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;For each of these, I track the minimum, maximum and average times. I look for outliers – things that suddenly change and so on.&lt;/p&gt;  &lt;p&gt;There are a lot of uses for this information. From performance tuning to developing a recovery plan, all of these actions need to be taken into account.&lt;/p&gt;  &lt;p&gt;I think I’ll write up an article sometime on how I do this – it’s a little long for a blog post.&lt;/p&gt;</description></item><item><title>Performance Tuning Methodology Preferences</title><link>http://sqlblog.com/blogs/buck_woody/archive/2010/01/20/performance-tuning-methodology-preferences.aspx</link><pubDate>Wed, 20 Jan 2010 12:22:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:21249</guid><dc:creator>BuckWoody</dc:creator><description>&lt;P style="MARGIN:0in 0in 0pt;" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;I’m holding Performance Tuning Workshops this week for my clients in Washington and Idaho. During that workshop, I explain that there are several ways to examine the SQL Server component of an application. There’s “Hardware Component Pressure Measurement”, “Code Optimization” and “Index Analysis” as starting points, and most folks start there and then move on to use all of them in a mix. But a newer methodology called ‘Wait State Analysis” helps you to evaluate what the system is waiting on, so that you can knock those down one at a time. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0pt;" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 0pt;" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;I mention in the presentations that there is a new whitepaper out on that, and I promised to share that link here. So without further ado, here it is: &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc966413.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;http://msdn.microsoft.com/en-us/library/cc966413.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; (link is at the bottom).&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description></item><item><title>Performance Counters? There’s a script for that.</title><link>http://sqlblog.com/blogs/buck_woody/archive/2010/01/05/performance-counters-there-s-a-script-for-that.aspx</link><pubDate>Tue, 05 Jan 2010 14:02:15 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:20555</guid><dc:creator>BuckWoody</dc:creator><description>&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font face="Calibri"&gt;&lt;font color="#000000"&gt;&lt;font size="3"&gt;It’s not hard to get Performance Monitor counters in PowerShell 1.0, and it’s REALLY easy in 2.0. This is one I used yesterday to monitor network bytes in and out on 2.0 (keep all of the green lines in this post on the same line) :         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="2"&gt;&lt;font face="Calibri"&gt;&lt;font color="#008000"&gt;get-counter -Counter &amp;quot;\Network Interface(*)\Bytes Total/sec&amp;quot; -SampleInterval 1 -MaxSamples 10         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;   &lt;p&gt;&lt;font color="#000000" size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font face="Calibri"&gt;&lt;font color="#000000"&gt;&lt;font size="3"&gt;The &lt;i style="mso-bidi-font-style:normal;"&gt;–SampleInterval&lt;/i&gt; is in seconds, and the &lt;i style="mso-bidi-font-style:normal;"&gt;–MaxSamples&lt;/i&gt; sets how many you want. The &lt;i style="mso-bidi-font-style:normal;"&gt;–Counter&lt;/i&gt; parameter is the object and counter you want to monitor. Don’t know what they are for your system? No problem:           &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="2"&gt;&lt;font face="Calibri"&gt;&lt;font color="#008000"&gt;get-counter -ListSet *         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;   &lt;p&gt;&lt;font color="#000000" size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font face="Calibri"&gt;&lt;font color="#000000"&gt;&lt;font size="3"&gt;Need to hit another computer? Easy Peasy – doesn’t even require remoting to be turned on (but you do need to have the rights to hit the perf counters):         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="2"&gt;&lt;font face="Calibri"&gt;&lt;font color="#008000"&gt;get-counter -ComputerName COLLOSSUS -Counter &amp;quot;\Network Interface(*)\Bytes Total/sec&amp;quot; -SampleInterval 1 -MaxSamples 10         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;   &lt;p&gt;&lt;font color="#000000" size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font color="#000000"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;If your machine happens not to be named “COLLOSSUS”, just change that part &lt;/font&gt;&lt;span style="font-family:wingdings;mso-ascii-font-family:calibri;mso-hansi-font-family:calibri;mso-char-type:symbol;mso-symbol-font-family:wingdings;"&gt;&lt;span style="mso-char-type:symbol;mso-symbol-font-family:wingdings;"&gt;J&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri"&gt;. And yes, you can use whatever counters you like, including SQL Server locks, blocks, etc. The full reference for get-counter is here: &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;a href="http://technet.microsoft.com/en-us/library/dd367892.aspx"&gt;&lt;u&gt;&lt;font color="#0000ff" size="3" face="Times New Roman"&gt;http://technet.microsoft.com/en-us/library/dd367892.aspx&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;    &lt;p&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style:normal;"&gt;&lt;font size="2"&gt;&lt;font face="Calibri"&gt;&lt;font color="#800000"&gt;&lt;strong&gt;Script Disclaimer, for people who need to be told this sort of thing:             &lt;p&gt;&lt;/p&gt;           &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style:normal;"&gt;&lt;font size="2"&gt;&lt;font face="Calibri"&gt;&lt;font color="#800000"&gt;Never trust any script, including those that you find here, until you understand exactly what it does and how it will act on your systems. Always check the script on a test system or Virtual Machine, not a production system. All scripts on this site are performed by a professional stunt driver on a closed course. Your mileage may vary. Void where prohibited. Offer good for a limited time only. Keep out of reach of small children. Do not operate heavy machinery while using this script. If you experience blurry vision, indigestion or heartburn during the operation of this script, see a physician.            &lt;p&gt;&lt;/p&gt;         &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/i&gt;&lt;/p&gt;</description></item><item><title>Measure Statement Performance with PowerShell</title><link>http://sqlblog.com/blogs/buck_woody/archive/2009/12/30/measure-statement-performance-with-powershell.aspx</link><pubDate>Wed, 30 Dec 2009 14:31:37 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:20376</guid><dc:creator>BuckWoody</dc:creator><description>&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font color="#000000"&gt;&lt;font face="Calibri"&gt;When you monitor for performance, you might start in the database server itself. But a true test really has more to do with the “round trip” of a data request from a client to a server and then the return of data back to the client. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font color="#000000"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font color="#000000"&gt;&lt;font size="3" face="Calibri"&gt;So I wired up this little test to simulate that process, and now I can run that from anywhere. The trick is the &lt;font color="#008000"&gt;measure-Command { }&lt;/font&gt; part, which brings back the time display. In my example, I’m testing the backup process, but your command can be anything you like. I’m also using the &lt;font color="#008000"&gt;ExecuteNonQuery&lt;/font&gt;&amp;#160; call, since I don’t want any data back. You might want to use the &lt;font color="#008000"&gt;ExecuteReader&lt;/font&gt; call if you do want data.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;   &lt;p&gt;&lt;font color="#000000" size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font color="#000000"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;If you want to try this (and remember, test system only, read and understand, etc.), you need to change the &lt;font color="#008000"&gt;SERVERNAME\INSTANCENAME&lt;/font&gt; to your system and instance names, and change the:          &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;font color="#008000"&gt;$sqlCommand.CommandText=&amp;quot;BACKUP DATABASE TESTDATABASE TO DISK='c:\TEMP\TESTDATABASE.bak' WITH INIT&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;font color="#000000"&gt;&lt;font face="Calibri"&gt;line to some command you want to run. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font color="#000000"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font color="#000000"&gt;&lt;font face="Calibri"&gt;I’ve alternated the colors – keep all of one color on one line:         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;   &lt;p&gt;&lt;font color="#000000" size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;font color="#008000"&gt;$sqlConnection = new-object System.Data.SqlClient.SqlConnection         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;font color="#800000"&gt;$sqlConnection.ConnectionString = &amp;quot;server=SERVERNAME\INSTANCENAME;integrated security=true;database=master&amp;quot;         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;font color="#008000"&gt;$sqlConnection.Open()         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;font color="#800000"&gt;$sqlCommand = new-object System.Data.SqlClient.SqlCommand         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;font color="#008000"&gt;$sqlCommand.CommandText=&amp;quot;BACKUP DATABASE TESTDATABASE TO DISK='c:\TEMP\TESTDATABASE.bak' WITH INIT&amp;quot;         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;font color="#800000"&gt;$sqlCommand.Connection=$sqlConnection         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;font color="#008000"&gt;Measure-command {$sqlCommand.ExecuteNonQuery()}         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;font color="#008000"&gt;$sqlConnection.Close()         &lt;p&gt;&lt;/p&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Monitoring SQL Azure For Performance</title><link>http://sqlblog.com/blogs/buck_woody/archive/2009/12/22/monitoring-sql-azure-for-performance.aspx</link><pubDate>Tue, 22 Dec 2009 14:33:20 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:20170</guid><dc:creator>BuckWoody</dc:creator><description>&lt;p&gt;In SQL Server Azure, there are no Dynamic Management Views (DMVs) or Performance Monitor Objects and Counters that you can access, so you can’t run your standard performance monitoring that way. I suspect that as time goes on, SQL Azure will have some instrumentation, but for the time being, you’ll have to go with a different metric – round trip throughput.&lt;/p&gt;  &lt;p&gt;What I mean by that is you’ll need to measure the start of a transaction and it’s completion. In the end, this is the only metric that matters anyway, but it is helpful to know what to fix – and this metric doesn’t help you with that.&lt;/p&gt;  &lt;p&gt;What’s been working for me is to develop my queries locally using all my tricks and tools, and then post those up to SQL Azure. While it’s not a one-to-one map, it does seem to fit the bill for now. I’ll keep you posted.&lt;/p&gt;</description></item></channel></rss>