{"id":106,"date":"2012-02-02T02:46:37","date_gmt":"2012-02-02T02:46:37","guid":{"rendered":"http:\/\/www.sqlfreelancer.com\/blog\/?p=106"},"modified":"2014-03-06T15:38:22","modified_gmt":"2014-03-06T15:38:22","slug":"client-statistics","status":"publish","type":"post","link":"https:\/\/www.sqlfreelancer.com\/blog\/client-statistics\/","title":{"rendered":"Client Statistics"},"content":{"rendered":"<p>A feature often overlooked while tuning queries is Client Statistics located right on SSMS editor bar.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-107\" alt=\"SQL Freelancer SQL Server Client Statistics\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics.png\" width=\"624\" height=\"29\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics.png 624w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-300x13.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/a><br \/>\nOther ways of opening Client Statistics include:<\/p>\n<p>SHIFT + ALT + S and Menu Bar \u2013 Query -&gt; Include Client Statistics<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-108\" alt=\"SQL Freelancer SQL Server Client Statistics\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-1.png\" width=\"307\" height=\"295\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-1.png 307w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-1-300x288.png 300w\" sizes=\"auto, (max-width: 307px) 100vw, 307px\" \/><\/a><\/p>\n<p>Client Statistics is useful when the user needs to gather information about execution times, processing times, the amount of data sent between client and server, etc. it\u2019s very easy to use. Simply turn it on using one of the methods above and execute your query.<\/p>\n<p>In this example I\u2019m using the following query:<\/p>\n<div>\n<pre>SELECT pc.FirstName\r\n,pc.LastName\r\n,pc.EmailAddress\r\n,he.Title\r\n,hh.Rate\r\nFROM Person.Contact pc\r\nJOIN HumanResources.Employee he ON pc.ContactID = he.ContactID\r\nJOIN HumanResources.EmployeePayHistory hh ON he.EmployeeID = hh.EmployeeID\r\nWHERE hh.Rate &gt; 10\r\nORDER BY hh.Rate<\/pre>\n<\/div>\n<p>After executing the query you will notice a new tab labeled Client Statistics:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109\" alt=\"SQL Freelancer SQL Server Client Statistics\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-2.png\" width=\"425\" height=\"335\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-2.png 425w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-2-300x236.png 300w\" sizes=\"auto, (max-width: 425px) 100vw, 425px\" \/><\/a><\/p>\n<p>After looking at the statistics provided for Trial 1 you can see the processing time = 39ms, execution time = 46ms, etc.<\/p>\n<p>After the running the same query again I get the following results under Trial 2:<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-110\" alt=\"SQL Freelancer SQL Server Client Statistics\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-3.png\" width=\"464\" height=\"311\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-3.png 464w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-3-300x201.png 300w\" sizes=\"auto, (max-width: 464px) 100vw, 464px\" \/><\/a><br \/>\nThis time processing time went up to 45ms and execution time went up to 51ms. It also has an average column to compare overall results. The green and red arrows represent differences between trials. Green arrows indicate improved statistics and red arrows indicate degrading statistics.<\/p>\n<p>A max of 10 trials can be run with the 11<sup>th<\/sup> trial dropping the 1<sup>st<\/sup> trial and so on. To reset statistics, on the menu bar, go to Query, Reset Client Statistics.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111\" alt=\"SQL Freelancer SQL Server Client Statistics\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-4.png\" width=\"311\" height=\"302\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-4.png 311w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Client-Statistics-4-300x291.png 300w\" sizes=\"auto, (max-width: 311px) 100vw, 311px\" \/><\/a>This is great when tuning indexes because you can see different statistics as you add\/delete indexes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A feature often overlooked while tuning queries is Client Statistics located right on SSMS editor bar. Other ways of opening Client Statistics include: SHIFT + ALT + S and Menu Bar \u2013 Query -&gt; Include Client Statistics Client Statistics is useful when the user needs to gather information about execution times, processing times, the amount [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[97,39,18,57],"class_list":["post-106","post","type-post","status-publish","format-standard","hentry","category-performance-tuning","tag-performance-tuning","tag-ssms","tag-statistics","tag-tuning"],"_links":{"self":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/comments?post=106"}],"version-history":[{"count":1,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":112,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/106\/revisions\/112"}],"wp:attachment":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/media?parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/categories?post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/tags?post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}