{"id":351,"date":"2016-10-18T11:37:45","date_gmt":"2016-10-18T16:37:45","guid":{"rendered":"https:\/\/www.baronsoftware.com\/Blog\/?p=351"},"modified":"2016-10-18T11:37:45","modified_gmt":"2016-10-18T16:37:45","slug":"getting-performance-statistics-cached-stored-procedures","status":"publish","type":"post","link":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/","title":{"rendered":"Getting performance statistics for cached stored procedures"},"content":{"rendered":"<p><a href=\"https:\/\/www.baronsoftware.com\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"7\" data-permalink=\"https:\/\/www.baronsoftware.com\/Blog\/delphi-create-a-process-or-shelling-to-start-up-an-external-application\/logo\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2014\/12\/logo-e1515620410626.jpg?fit=200%2C36&amp;ssl=1\" data-orig-size=\"200,36\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"logo\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2014\/12\/logo-e1515620410626.jpg?fit=200%2C36&amp;ssl=1\" class=\"aligncenter size-full wp-image-7\" src=\"https:\/\/i0.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2014\/12\/logo.jpg?resize=450%2C80&#038;ssl=1\" alt=\"Baron Software\" width=\"450\" height=\"80\" \/><\/a><\/p>\n<h3 style=\"text-align: center;\">Getting performance statistics for cached stored procedures<\/h3>\n<p>It is always extremely important to maintain your SQL server to the utmost efficiency.\u00a0\u00a0\u00a0 DBAs review the database structure and whether certain pieces such as stored procedures, triggers, etc. can be tuned even further.\u00a0 One of the areas that will be discussed are the stored procedure which can be used during any time as well as day.<\/p>\n<h5 style=\"text-align: center;\">\u00a0Dynamic Management Views and Function (DMVs and DMFs) to identify resources used by stored procedures<\/h5>\n<p>DMVs and DMFs were introduced in SQL Server 2005 and\u00a0are able to obtain figures only for those stored procedures that have execution plans in the procedure cache. \u00a0The SQL Server engine starts gathering information about the performance of a stored procedure the first time that \u00a0the plan is placed in the procedure cache.\u00a0 As long as the stored procedure\u2019s execution plan stays in the cache, SQL Server keeps updating the performance figures every time the stored procedure is executed. If the execution plan for a stored procedure is dropped from the procedure cache then the metrics for the stored procedure are also removed.\u00a0 Therefore you will only be able to obtain metrics for those stored procedures that have cached plans, and those metrics will contain a summarization of the amount of resources used since the stored procedure was compiled, and its\u2019 execution plan was placed in the procedure cache.\u00a0 One thing to keep in mind is whether you are using the SP_RECOMPILE procedure for any or all stored procedures, that will remove the statistical information.<\/p>\n<h3 style=\"text-align: center;\">sys.dm_exec_procedure_stats<\/h3>\n<p>This DMV was introduced with SQL Server 2008. \u00a0\u00a0By using this DMV, you can returns metrics for stored procedures, but it does not directly identify the stored procedure by name.\u00a0 Instead, the DMV only identifies the object_id, and a database_id for each stored procedure:\u00a0 Therefore to identify the actual stored procedure name, that the performance figures belong to, you should either join the output of this DMV with one of the system views within the appropriate database, or use a few metadata functions.<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #3366ff;\">SELECT TOP 10 <\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fld.object_id, <\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0 fld.database_id, <\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0 OBJECT_NAME(object_id, database_id) &#8216;SP name&#8217;,\u00a0\u00a0 <\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0\u00a0 \u00a0fld.cached_time, <\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0\u00a0\u00a0 fld.last_execution_time,\u00a0<\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0\u00a0\u00a0\u00a0fld.total_elapsed_time,\u00a0 <\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0\u00a0 \u00a0fld.total_elapsed_time\/fld.execution_count AS [avg_elapsed_time],\u00a0 <\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0\u00a0 \u00a0fld.last_elapsed_time, fld.execution_count\u00a0 <\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0FROM sys.dm_exec_procedure_stats AS fld <\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0where database_id &lt;&gt; 32767<\/span><br \/>\n<span style=\"color: #3366ff;\">\u00a0\u00a0ORDER BY [total_worker_time] DESC;<\/span><\/p>\n<p>This SQL example demonstrates the information pertaining to the stored procedures.\u00a0 This allows you to review what if possible is performing poorly or long.<\/p>\n<ul>\n<li>cached_time: when the procedure was cached or last started.<\/li>\n<li>last_execution_time: when the procedure was last executed.<\/li>\n<li>execution_count: this tells you the amount of times the procedure was executed<\/li>\n<\/ul>\n<p>I would suggest to not to display the resource database which always has a ID of 32767 and you can view that in the where clause.<\/p>\n<p>The Resource database is a read-only database that contains all the system objects that are included with SQL Server. SQL Server system objects, such as sys.objects, are physically persisted in the Resource database, but they logically appear in the sys schema of every database. The Resource database does not contain user data or user metadata. (from BOL).\u00a0 In SQL Server the maximum databases per instances that can be created are 32,767. This last number has been reserved by Resource Database itself.<\/p>\n<h3 style=\"text-align: center;\"><strong>sys.dm_exec_query_stats<\/strong><\/h3>\n<p>This\u00a0DMV can be used to obtain statement level metrics.\u00a0 These metrics are only available if the statement comes from a cached plan.\u00a0 By using this DMV and summarizing the statement metrics up to the plan level, you are able to identify metrics for stored procedures.<\/p>\n<pre><span style=\"color: #3366ff;\">SELECT TOP 10 \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DB_NAME(dbid) AS DatabaseName,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 OBJECT_SCHEMA_NAME(objectid,dbid) AS [SCHEMA_NAME],\u00a0 \r\n\u00a0\u00a0\u00a0\u00a0\u00a0 OBJECT_NAME(objectid,dbid)AS [Process_Name],\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 MAX(qs.creation_time) AS 'cache_time',\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 MAX(last_execution_time) AS 'last_execution_time',\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 MAX(usecounts) AS [execution_count],\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 SUM(total_worker_time) \/ SUM(usecounts) AS AVG_CPU,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 SUM(total_elapsed_time) \/ SUM(usecounts) AS AVG_ELAPSED,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 SUM(total_logical_reads) \/ SUM(usecounts) AS AVG_LOGICAL_READS,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 SUM(total_logical_writes) \/ SUM(usecounts) AS AVG_LOGICAL_WRITES,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 SUM(total_physical_reads) \/ SUM(usecounts)AS AVG_PHYSICAL_READS\u00a0\u00a0\u00a0\u00a0\u00a0 \r\n\u00a0\u00a0FROM sys.dm_exec_query_stats qs\u00a0 \r\n\u00a0\u00a0\u00a0join sys.dm_exec_cached_plans cp on qs.plan_handle = cp.plan_handle \r\n\u00a0\u00a0\u00a0CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) \r\n\u00a0\u00a0WHERE objtype = 'Proc' AND text NOT LIKE '%CREATE FUNC%' and dbid &lt;&gt; 32767\r\n\u00a0\u00a0GROUP BY execution_count, cp.plan_handle, DBID, objectid \r\n\u00a0\u00a0ORDER BY execution_count DESC<\/span><\/pre>\n<h3 style=\"text-align: center;\">Final Wrap up<\/h3>\n<p>As demonstrated these queries will provide you with a simple method to view the stored procedures performances.\u00a0 You can tune the stored procedures that need it by watching the various reporting fields displayed.\u00a0\u00a0\u00a0 You have the ability of storing this information or exporting it to Excel for maintaining a log over a time period.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting performance statistics for cached stored procedures It is always extremely important to maintain your SQL server to the utmost efficiency.\u00a0\u00a0\u00a0 DBAs review the database structure and whether certain pieces such as stored procedures, triggers, etc. can be tuned even further.\u00a0 One of the areas that will be discussed are the stored procedure which can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rop_custom_images_group":[],"rop_custom_messages_group":[],"rop_publish_now":"initial","rop_publish_now_accounts":[],"rop_publish_now_history":[],"rop_publish_now_status":"pending","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[39,20,7,13,47,8,29,28,15,37,6,36,24],"class_list":["post-351","post","type-post","status-publish","format-standard","hentry","category-sql-tips","tag-dbartisan","tag-delphi","tag-development","tag-embarcadero","tag-idera","tag-lazarus","tag-linux","tag-mac","tag-microsoft","tag-rapid-sql","tag-software","tag-sql-server","tag-windows-10"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Getting performance statistics for cached stored procedures - Baron Software<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting performance statistics for cached stored procedures\" \/>\n<meta property=\"og:description\" content=\"It is always extremely important to maintain your SQL server to the utmost efficiency.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/\" \/>\n<meta property=\"og:site_name\" content=\"Baron Software\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-18T16:37:45+00:00\" \/>\n<meta name=\"author\" content=\"richard@baronsoftware.com\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Getting performance statistics for cached stored procedures\" \/>\n<meta name=\"twitter:description\" content=\"It is always extremely important to maintain your SQL server to the utmost efficiency.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2014\/12\/logo.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@Rbaroniunas\" \/>\n<meta name=\"twitter:site\" content=\"@Rbaroniunas\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"richard@baronsoftware.com\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/\"},\"author\":{\"name\":\"richard@baronsoftware.com\",\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/#\\\/schema\\\/person\\\/079d370e4230be9d5f75885bb33dd8cd\"},\"headline\":\"Getting performance statistics for cached stored procedures\",\"datePublished\":\"2016-10-18T16:37:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/\"},\"wordCount\":694,\"publisher\":{\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/wp-content\\\/uploads\\\/2014\\\/12\\\/logo.jpg\",\"keywords\":[\"DBArtisan\",\"Delphi\",\"Development\",\"Embarcadero\",\"Idera\",\"Lazarus\",\"Linux\",\"Mac\",\"Microsoft\",\"Rapid SQL\",\"Software\",\"SQL Server\",\"Windows 10\"],\"articleSection\":[\"SQL Tips\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/\",\"url\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/\",\"name\":\"Getting performance statistics for cached stored procedures - Baron Software\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/wp-content\\\/uploads\\\/2014\\\/12\\\/logo.jpg\",\"datePublished\":\"2016-10-18T16:37:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/wp-content\\\/uploads\\\/2014\\\/12\\\/logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/wp-content\\\/uploads\\\/2014\\\/12\\\/logo.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/getting-performance-statistics-cached-stored-procedures\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Getting performance statistics for cached stored procedures\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/#website\",\"url\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/\",\"name\":\"Baron Software\",\"description\":\"Highest Quality Software Developed.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/#organization\",\"name\":\"Baron Software\",\"url\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/i2.wp.com\\\/www.baronsoftware.com\\\/Blog\\\/wp-content\\\/uploads\\\/2018\\\/01\\\/BaronSoftwareLogo.fw_.png?fit=1920%2C400&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i2.wp.com\\\/www.baronsoftware.com\\\/Blog\\\/wp-content\\\/uploads\\\/2018\\\/01\\\/BaronSoftwareLogo.fw_.png?fit=1920%2C400&ssl=1\",\"width\":1920,\"height\":400,\"caption\":\"Baron Software\"},\"image\":{\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/Rbaroniunas\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.baronsoftware.com\\\/Blog\\\/#\\\/schema\\\/person\\\/079d370e4230be9d5f75885bb33dd8cd\",\"name\":\"richard@baronsoftware.com\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e5a3cc457a883c420e8af899f2639359d220ae6bfed4587ca7ed17f45ca0c21c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e5a3cc457a883c420e8af899f2639359d220ae6bfed4587ca7ed17f45ca0c21c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e5a3cc457a883c420e8af899f2639359d220ae6bfed4587ca7ed17f45ca0c21c?s=96&d=mm&r=g\",\"caption\":\"richard@baronsoftware.com\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting performance statistics for cached stored procedures - Baron Software","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/","og_locale":"en_US","og_type":"article","og_title":"Getting performance statistics for cached stored procedures","og_description":"It is always extremely important to maintain your SQL server to the utmost efficiency.","og_url":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/","og_site_name":"Baron Software","article_published_time":"2016-10-18T16:37:45+00:00","author":"richard@baronsoftware.com","twitter_card":"summary_large_image","twitter_title":"Getting performance statistics for cached stored procedures","twitter_description":"It is always extremely important to maintain your SQL server to the utmost efficiency.","twitter_image":"https:\/\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2014\/12\/logo.jpg","twitter_creator":"@Rbaroniunas","twitter_site":"@Rbaroniunas","twitter_misc":{"Written by":"richard@baronsoftware.com","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/#article","isPartOf":{"@id":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/"},"author":{"name":"richard@baronsoftware.com","@id":"https:\/\/www.baronsoftware.com\/Blog\/#\/schema\/person\/079d370e4230be9d5f75885bb33dd8cd"},"headline":"Getting performance statistics for cached stored procedures","datePublished":"2016-10-18T16:37:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/"},"wordCount":694,"publisher":{"@id":"https:\/\/www.baronsoftware.com\/Blog\/#organization"},"image":{"@id":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/#primaryimage"},"thumbnailUrl":"https:\/\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2014\/12\/logo.jpg","keywords":["DBArtisan","Delphi","Development","Embarcadero","Idera","Lazarus","Linux","Mac","Microsoft","Rapid SQL","Software","SQL Server","Windows 10"],"articleSection":["SQL Tips"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/","url":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/","name":"Getting performance statistics for cached stored procedures - Baron Software","isPartOf":{"@id":"https:\/\/www.baronsoftware.com\/Blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/#primaryimage"},"image":{"@id":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/#primaryimage"},"thumbnailUrl":"https:\/\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2014\/12\/logo.jpg","datePublished":"2016-10-18T16:37:45+00:00","breadcrumb":{"@id":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/#primaryimage","url":"https:\/\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2014\/12\/logo.jpg","contentUrl":"https:\/\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2014\/12\/logo.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.baronsoftware.com\/Blog\/getting-performance-statistics-cached-stored-procedures\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.baronsoftware.com\/Blog\/"},{"@type":"ListItem","position":2,"name":"Getting performance statistics for cached stored procedures"}]},{"@type":"WebSite","@id":"https:\/\/www.baronsoftware.com\/Blog\/#website","url":"https:\/\/www.baronsoftware.com\/Blog\/","name":"Baron Software","description":"Highest Quality Software Developed.","publisher":{"@id":"https:\/\/www.baronsoftware.com\/Blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.baronsoftware.com\/Blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.baronsoftware.com\/Blog\/#organization","name":"Baron Software","url":"https:\/\/www.baronsoftware.com\/Blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.baronsoftware.com\/Blog\/#\/schema\/logo\/image\/","url":"https:\/\/i2.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2018\/01\/BaronSoftwareLogo.fw_.png?fit=1920%2C400&ssl=1","contentUrl":"https:\/\/i2.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2018\/01\/BaronSoftwareLogo.fw_.png?fit=1920%2C400&ssl=1","width":1920,"height":400,"caption":"Baron Software"},"image":{"@id":"https:\/\/www.baronsoftware.com\/Blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/Rbaroniunas"]},{"@type":"Person","@id":"https:\/\/www.baronsoftware.com\/Blog\/#\/schema\/person\/079d370e4230be9d5f75885bb33dd8cd","name":"richard@baronsoftware.com","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e5a3cc457a883c420e8af899f2639359d220ae6bfed4587ca7ed17f45ca0c21c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e5a3cc457a883c420e8af899f2639359d220ae6bfed4587ca7ed17f45ca0c21c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e5a3cc457a883c420e8af899f2639359d220ae6bfed4587ca7ed17f45ca0c21c?s=96&d=mm&r=g","caption":"richard@baronsoftware.com"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2e6qU-5F","jetpack-related-posts":[{"id":361,"url":"https:\/\/www.baronsoftware.com\/Blog\/sql-stored-procedures-get-folder-files\/","url_meta":{"origin":351,"position":0},"title":"SQL Stored Procedures to get folder and files","author":"richard@baronsoftware.com","date":"October 20, 2016","format":false,"excerpt":"\u00a0 SQL Stored Procedures to get folder and files There may be a time when you will need to get the file name contents from a folder for the purpose of using the information in your stored procedure.\u00a0 The one undocumented stored procedure on Microsoft SQL Server 2016 is master.sys.xp_dirtree\u2026","rel":"","context":"In &quot;SQL Tips&quot;","block_context":{"text":"SQL Tips","link":"https:\/\/www.baronsoftware.com\/Blog\/category\/sql-tips\/"},"img":{"alt_text":"Baron Software","src":"https:\/\/i0.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2014\/12\/logo.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":201,"url":"https:\/\/www.baronsoftware.com\/Blog\/embarcadero-and-baron-software-powerstudio-case-study-which-monitors-sql-performance\/","url_meta":{"origin":351,"position":1},"title":"Embarcadero and Baron Software Powerstudio case study which monitors SQL Performance","author":"richard@baronsoftware.com","date":"January 7, 2016","format":false,"excerpt":"Embarcadero and Baron Software has issued a case study that demonstrates the benefits of using Microsoft SQL Powerstudio product line. \u00a0Powerstudio is a robust package that monitors SQL performance and can provide assistance for clients to update or create tables, stored procedures, etc. for various SQL servers some being Oracle,\u2026","rel":"","context":"In &quot;Rad Studio Delphi Development&quot;","block_context":{"text":"Rad Studio Delphi Development","link":"https:\/\/www.baronsoftware.com\/Blog\/category\/rad-studio-embarcadero-delphi-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2016\/01\/Case-Study.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2016\/01\/Case-Study.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2016\/01\/Case-Study.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":289,"url":"https:\/\/www.baronsoftware.com\/Blog\/expedite-sql-development-rapid-sql\/","url_meta":{"origin":351,"position":2},"title":"Expedite SQL with Idera Rapid SQL 2016","author":"richard@baronsoftware.com","date":"June 9, 2016","format":false,"excerpt":"Expedite SQL Development with Rapid SQL 2016 \u2022 Write code across different database platforms - Produce high-performing SQL code across DBMS platforms (Oracle, SQL Server, DB2, Sybase and PostgreSQL) from one user interface. \u2022 Develop SQL code quickly and efficiently - The SQL IDE is a clean, slick development environment,\u2026","rel":"","context":"In &quot;SQL Tips&quot;","block_context":{"text":"SQL Tips","link":"https:\/\/www.baronsoftware.com\/Blog\/category\/sql-tips\/"},"img":{"alt_text":"Idera rapid sql 2016","src":"https:\/\/i0.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2016\/03\/Idera.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":928,"url":"https:\/\/www.baronsoftware.com\/Blog\/microsoft-sql-server-how-to-get-a-table-size\/","url_meta":{"origin":351,"position":3},"title":"Microsoft SQL Server how to get a table size","author":"richard@baronsoftware.com","date":"July 22, 2018","format":false,"excerpt":"Microsoft SQL Server how to get a table size Sometimes you need to get the size of a particular table located in a database within the Microsoft Server and the following query can provide you that.\u00a0 You can run this manually or place it in a stored procedure for numerous\u2026","rel":"","context":"In &quot;SQL Tips&quot;","block_context":{"text":"SQL Tips","link":"https:\/\/www.baronsoftware.com\/Blog\/category\/sql-tips\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":249,"url":"https:\/\/www.baronsoftware.com\/Blog\/idera-and-embarcadero-separate-business\/","url_meta":{"origin":351,"position":4},"title":"Idera and Embarcadero separate target businesses","author":"richard@baronsoftware.com","date":"March 8, 2016","format":false,"excerpt":"\u00a0 Idera and Embarcadero separate target businesses \u00a0 Idera and Embarcadero have officially separated their businesses for software development Rad Studio that contains Delphi \/ C++ Builder and the Idera database tools. \u00a0This is a fantastic step in going forward and bringing both web sites with a fresh look on\u2026","rel":"","context":"In &quot;Rad Studio Delphi Development&quot;","block_context":{"text":"Rad Studio Delphi Development","link":"https:\/\/www.baronsoftware.com\/Blog\/category\/rad-studio-embarcadero-delphi-development\/"},"img":{"alt_text":"embarcadero-idera-separate","src":"https:\/\/i0.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2016\/03\/Seattle.jpeg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":610,"url":"https:\/\/www.baronsoftware.com\/Blog\/purge-microsoft-sql-email-items\/","url_meta":{"origin":351,"position":5},"title":"How to purge Microsoft SQL email Items","author":"richard@baronsoftware.com","date":"October 2, 2017","format":false,"excerpt":"How to purge Microsoft SQL email Items There are times that housecleaning older mail in your database needs to be done.\u00a0 A simple scheduled task can be done every month to purge what is no longer necessary.\u00a0 SQL Server stores all mails and attachments in\u00a0msdb\u00a0database. To avoid unnecessary growth of\u00a0msdb\u00a0database\u2026","rel":"","context":"In &quot;Computer PC Tips - bits and bytes&quot;","block_context":{"text":"Computer PC Tips - bits and bytes","link":"https:\/\/www.baronsoftware.com\/Blog\/category\/pc-tips-bits-bytes\/"},"img":{"alt_text":"Purge","src":"https:\/\/i0.wp.com\/www.baronsoftware.com\/Blog\/wp-content\/uploads\/2016\/10\/microsofts-logo-gets-a-makeover-300x225.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.baronsoftware.com\/Blog\/wp-json\/wp\/v2\/posts\/351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.baronsoftware.com\/Blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.baronsoftware.com\/Blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.baronsoftware.com\/Blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.baronsoftware.com\/Blog\/wp-json\/wp\/v2\/comments?post=351"}],"version-history":[{"count":1,"href":"https:\/\/www.baronsoftware.com\/Blog\/wp-json\/wp\/v2\/posts\/351\/revisions"}],"predecessor-version":[{"id":352,"href":"https:\/\/www.baronsoftware.com\/Blog\/wp-json\/wp\/v2\/posts\/351\/revisions\/352"}],"wp:attachment":[{"href":"https:\/\/www.baronsoftware.com\/Blog\/wp-json\/wp\/v2\/media?parent=351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baronsoftware.com\/Blog\/wp-json\/wp\/v2\/categories?post=351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baronsoftware.com\/Blog\/wp-json\/wp\/v2\/tags?post=351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}