{"id":14479,"date":"2020-08-13T18:09:21","date_gmt":"2020-08-13T16:09:21","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/"},"modified":"2025-10-01T11:46:57","modified_gmt":"2025-10-01T09:46:57","slug":"sql-server-high-sqlconnectionpool-memory-clerk-consumption","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/","title":{"rendered":"SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption"},"content":{"rendered":"<p>In this blog post, I will show you what I did to troubleshoot an interesting problem with Memory on SQL Server.<\/p>\n<p>It all started with a job performing DBCC CHECKDB on all databases taking hours to complete instead of 10 minutes.<br \/>\nSo the Job ran outside of its maintenance window, still running in the morning when users come back to the office. They immediately complained about poor application performance.<\/p>\n<p>While running the CHECKDB we could see many sessions in a SUSPENDED state with SELECT queries waiting on &#8220;RESOURCE_SEMAPHORE&#8221;.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-42418\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png\" alt=\"\" width=\"517\" height=\"254\" \/><\/a>The instance seemed to be starving on Memory.<br \/>\nWe tried to increase the &#8220;Max Server Memory&#8221; by 2GB. This solved the issue.\u00a0 Temporarily.<br \/>\nAround a week later the same issue occurred again with users complaining of very bad performance. The CHECKDB Job was running again for hours.<\/p>\n<p>I did more analysis of the memory usage for this instance. Identifying the biggest memory consumers is key to proceeding with investigation.<br \/>\nThe amount of memory allocated to each memory clerk can be found using the <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/system-dynamic-management-views\/sys-dm-os-memory-clerks-transact-sql\">sys.dm_os_memory_clerks<\/a> DMV.<br \/>\nWe can notice a very high value for the Memory clerk &#8220;SQLCONNECTIONPOOL&#8221;.<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/SQL17IN01LI01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-42420\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/SQL17IN01LI01.png\" alt=\"\" width=\"339\" height=\"87\" \/><\/a><\/p>\n<p>The &#8220;Max Server Memory&#8221; value of this instance is configured to 14GB. So half of it is allocated to the SQLCONNECTIONPOOL Memory Clerk. This is obviously not a normal situation.<\/p>\n<p>We decided to perform a Failover of the Availability Group to clear all the memory on the instance to perform the CHECKDB.<br \/>\nFrom there I created a Job monitoring the Memory Clerk usage. The query is from one of <a href=\"https:\/\/glennsqlperformance.com\/resources\/\">Glenn Berry&#8217;s diagnostic queries<\/a>.<br \/>\nHere is the SQL.<\/p>\n<div>\n<div id=\"highlighter_601465\" class=\"syntaxhighlighter  sql\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<div class=\"line number9 index8 alt2\">9<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<div class=\"line number11 index10 alt2\">11<\/div>\n<div class=\"line number12 index11 alt1\">12<\/div>\n<div class=\"line number13 index12 alt2\">13<\/div>\n<div class=\"line number14 index13 alt1\">14<\/div>\n<div class=\"line number15 index14 alt2\">15<\/div>\n<div class=\"line number16 index15 alt1\">16<\/div>\n<div class=\"line number17 index16 alt2\">17<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"sql comments\">-- The monitoring Table<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"sql plain\">use dbi_tools<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"sql plain\">go<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"sql keyword\">create<\/code> <code class=\"sql keyword\">table<\/code> <code class=\"sql plain\">monitoring.memoryClerkType (<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql plain\">mct_id <\/code><code class=\"sql keyword\">int<\/code> <code class=\"sql plain\">identity <\/code><code class=\"sql color1\">not<\/code> <code class=\"sql color1\">null<\/code> <code class=\"sql keyword\">primary<\/code> <code class=\"sql keyword\">key<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql plain\">, mct_logdate datetime2 <\/code><code class=\"sql keyword\">default<\/code> <code class=\"sql plain\">getdate()<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql plain\">, mct_MemoryClerkType nvarchar(256) <\/code><code class=\"sql color1\">not<\/code> <code class=\"sql color1\">null<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql plain\">, mct_memoryUsageMB <\/code><code class=\"sql keyword\">DECIMAL<\/code><code class=\"sql plain\">(15,2)<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"sql plain\">);<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"sql comments\">-- The query inside an SQL Server Agent Job<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"sql keyword\">insert<\/code> <code class=\"sql keyword\">into<\/code> <code class=\"sql plain\">dbi_tools.monitoring.memoryClerkType(mct_MemoryClerkType, mct_memoryUsageMB)<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql keyword\">SELECT<\/code> <code class=\"sql keyword\">TOP<\/code><code class=\"sql plain\">(10) mc.[type] <\/code><code class=\"sql keyword\">AS<\/code> <code class=\"sql plain\">[Memory Clerk Type], <\/code><\/div>\n<div class=\"line number14 index13 alt1\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql color2\">CAST<\/code><code class=\"sql plain\">((<\/code><code class=\"sql color2\">SUM<\/code><code class=\"sql plain\">(mc.pages_kb)\/1024.0) <\/code><code class=\"sql keyword\">AS<\/code> <code class=\"sql keyword\">DECIMAL<\/code> <code class=\"sql plain\">(15,2)) <\/code><code class=\"sql keyword\">AS<\/code> <code class=\"sql plain\">[Memory Usage (MB)] <\/code><\/div>\n<div class=\"line number15 index14 alt2\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql keyword\">FROM<\/code> <code class=\"sql plain\">sys.dm_os_memory_clerks <\/code><code class=\"sql keyword\">AS<\/code> <code class=\"sql plain\">mc <\/code><code class=\"sql keyword\">WITH<\/code> <code class=\"sql plain\">(NOLOCK)<\/code><\/div>\n<div class=\"line number16 index15 alt1\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql keyword\">GROUP<\/code> <code class=\"sql keyword\">BY<\/code> <code class=\"sql plain\">mc.[type]\u00a0 <\/code><\/div>\n<div class=\"line number17 index16 alt2\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql keyword\">ORDER<\/code> <code class=\"sql keyword\">BY<\/code> <code class=\"sql color2\">SUM<\/code><code class=\"sql plain\">(mc.pages_kb) <\/code><code class=\"sql keyword\">DESC<\/code> <code class=\"sql keyword\">OPTION<\/code> <code class=\"sql plain\">(RECOMPILE);<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>This allowed me to confirm that the Memory allocated to SQLCONNECTIONPOOL is increasing over time.<br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/SQLCONNECTIONPOOLMB.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-42422 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/SQLCONNECTIONPOOLMB.png\" alt=\"\" width=\"975\" height=\"497\" \/><\/a><\/p>\n<p>This causes internal Memory pressure on the instance. As more and more memory is allocated to this Memory Clerk the memory available for the Buffer Pool slowly decreases. Any event that requires a lot of memory like a DBCC CHECKDB would flush memory from the Buffer Pool but the memory allocated to SQLCONNECTIONPOOL is be flushed. This is a real issue.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/BP_SQLCONNECTTION_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-42423 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/BP_SQLCONNECTTION_2.png\" alt=\"\" width=\"963\" height=\"588\" \/><\/a><\/p>\n<p>This issue is described in an SQL Server CAT article: <a href=\"https:\/\/docs.microsoft.com\/en-us\/archive\/blogs\/sqlcat\/watch-out-those-prepared-sql-statements\">Watch out those prepared SQL statements<\/a><\/p>\n<p>Basically, some application server is calling <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/system-stored-procedures\/sp-prepare-transact-sql\">sp_prepare<\/a> system procedure through an ODBC driver and do not call <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/system-stored-procedures\/sp-unprepare-transact-sql\">sp_unprepare<\/a>.<br \/>\nThis seems to be a bug in the ODBC driver. There&#8217;s not much to do on the MSSQL server.<\/p>\n<p>My instance has dozens of databases for different applications. I need to identify which database, and so which application server needs an ODBC driver update.<br \/>\nTo do so I created an Extended Event session. There are events for sp_prepare and sp_unprepare in the &#8220;execution&#8221; category.<br \/>\n<a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/XE_category.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-42425\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/XE_category.png\" alt=\"\" width=\"843\" height=\"399\" \/><\/a><\/p>\n<p>Here is the T-SQL for this XE session:<\/p>\n<div>\n<div id=\"highlighter_672785\" class=\"syntaxhighlighter  sql\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<div class=\"line number9 index8 alt2\">9<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"sql keyword\">CREATE<\/code> <code class=\"sql plain\">EVENT SESSION [dbi_sna_memory] <\/code><code class=\"sql keyword\">ON<\/code> <code class=\"sql plain\">SERVER <\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"sql keyword\">ADD<\/code> <code class=\"sql plain\">EVENT sqlserver.prepare_sql(<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql keyword\">ACTION<\/code><code class=\"sql plain\">(sqlserver.client_app_name,sqlserver.client_hostname<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql plain\">,sqlserver.database_name,sqlserver.session_id,sqlserver.username)),<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"sql keyword\">ADD<\/code> <code class=\"sql plain\">EVENT sqlserver.unprepare_sql(<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql keyword\">ACTION<\/code><code class=\"sql plain\">(sqlserver.client_app_name,sqlserver.client_hostname<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql plain\">,sqlserver.database_name,sqlserver.session_id,sqlserver.username))<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"sql keyword\">ADD<\/code> <code class=\"sql plain\">TARGET package0.event_file(<\/code><code class=\"sql keyword\">SET<\/code> <code class=\"sql plain\">filename=N<\/code><code class=\"sql string\">'dbi_sna_memory'<\/code><code class=\"sql plain\">,max_file_size=(500))<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"sql keyword\">WITH<\/code> <code class=\"sql plain\">(STARTUP_STATE=<\/code><code class=\"sql keyword\">ON<\/code><code class=\"sql plain\">)<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"sql plain\">GO<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Looking at the live data I could see a lot of sp_prepare without any sp_unprepare for one of the databases.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/XE_prepare_sql_BLOG_2-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-42437\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/XE_prepare_sql_BLOG_2-1.png\" alt=\"\" width=\"830\" height=\"552\" \/><\/a><\/p>\n<p>Sessions to the database in blue color doesn&#8217;t seem to call the sp_unprepare system procedure.<br \/>\nLooking at the Extended Event data with SQL I get a better view of the situation.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/UnpreparePct_BLOG.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-42438\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/UnpreparePct_BLOG.png\" alt=\"\" width=\"339\" height=\"177\" \/><\/a><\/p>\n<p>Based on a sample of approximately 1 Million events, it&#8217;s obvious that the first database is the one doing the most sp_prepare events. There are only 1% of sp_unprepare calls which is clearly abnormal compared to the other databases with an expected value of 99%-100%.<br \/>\nJust for information here is the query I did to get the result above:<\/p>\n<div>\n<div id=\"highlighter_435980\" class=\"syntaxhighlighter  sql\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"sql keyword\">select<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql color2\">SUM<\/code><code class=\"sql plain\">(IIF(eventName=<\/code><code class=\"sql string\">'prepare_sql'<\/code><code class=\"sql plain\">, 1, 0)) <\/code><code class=\"sql keyword\">AS<\/code> <code class=\"sql keyword\">Prepare<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql plain\">, <\/code><code class=\"sql color2\">SUM<\/code><code class=\"sql plain\">(IIF(eventName=<\/code><code class=\"sql string\">'unprepare_sql'<\/code><code class=\"sql plain\">, 1, 0)) <\/code><code class=\"sql keyword\">AS<\/code> <code class=\"sql plain\">Unpepare<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql plain\">, ROUND(<\/code><code class=\"sql color2\">CAST<\/code><code class=\"sql plain\">(<\/code><code class=\"sql color2\">SUM<\/code><code class=\"sql plain\">(IIF(eventName=<\/code><code class=\"sql string\">'unprepare_sql'<\/code><code class=\"sql plain\">, 1, 0)) <\/code><code class=\"sql keyword\">AS<\/code> <code class=\"sql keyword\">FLOAT<\/code><code class=\"sql plain\">)\/<\/code><code class=\"sql color2\">SUM<\/code><code class=\"sql plain\">(IIF(eventName=<\/code><code class=\"sql string\">'prepare_sql'<\/code><code class=\"sql plain\">, 1, 0))*100, 2) <\/code><code class=\"sql keyword\">AS<\/code> <code class=\"sql plain\">unPreparePct<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"sql spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"sql plain\">, dbName<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"sql keyword\">from<\/code> <code class=\"sql plain\">dbi_tools.dbo.xe_Memory_data <\/code><code class=\"sql comments\">-- Table with data from the XE session file<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"sql keyword\">group<\/code> <code class=\"sql keyword\">by<\/code> <code class=\"sql plain\">dbName<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"sql keyword\">order<\/code> <code class=\"sql keyword\">by<\/code> <code class=\"sql plain\">1 <\/code><code class=\"sql keyword\">desc<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The culprit is now identified. We can update the client layer on the application server and look for improvement in memory usage.<\/p>\n<p>Written by <a href=\"https:\/\/www.linkedin.com\/in\/steven-naudet-aa540158\/\">Steven Naudet<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post, I will show you what I did to troubleshoot an interesting problem with Memory on SQL Server. It all started with a job performing DBCC CHECKDB on all databases taking hours to complete instead of 10 minutes. So the Job ran outside of its maintenance window, still running in the morning [&hellip;]<\/p>\n","protected":false},"author":26,"featured_media":14480,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229,99],"tags":[1495,2550,2059],"type_dbi":[],"class_list":["post-14479","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-administration-monitoring","category-sql-server","tag-memory-consumption","tag-sql-server-2","tag-sqlconnectionpool"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption - dbi Blog<\/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.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption\" \/>\n<meta property=\"og:description\" content=\"In this blog post, I will show you what I did to troubleshoot an interesting problem with Memory on SQL Server. It all started with a job performing DBCC CHECKDB on all databases taking hours to complete instead of 10 minutes. So the Job ran outside of its maintenance window, still running in the morning [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-13T16:09:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-01T09:46:57+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png\" \/>\n\t<meta property=\"og:image:width\" content=\"517\" \/>\n\t<meta property=\"og:image:height\" content=\"254\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Microsoft Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Microsoft Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/\"},\"author\":{\"name\":\"Microsoft Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\"},\"headline\":\"SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption\",\"datePublished\":\"2020-08-13T16:09:21+00:00\",\"dateModified\":\"2025-10-01T09:46:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/\"},\"wordCount\":602,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png\",\"keywords\":[\"memory consumption\",\"SQL Server\",\"SQLCONNECTIONPOOL\"],\"articleSection\":[\"Database Administration &amp; Monitoring\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/\",\"name\":\"SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png\",\"datePublished\":\"2020-08-13T16:09:21+00:00\",\"dateModified\":\"2025-10-01T09:46:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png\",\"width\":517,\"height\":254},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\",\"name\":\"Microsoft Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"caption\":\"Microsoft Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption - dbi Blog","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.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption","og_description":"In this blog post, I will show you what I did to troubleshoot an interesting problem with Memory on SQL Server. It all started with a job performing DBCC CHECKDB on all databases taking hours to complete instead of 10 minutes. So the Job ran outside of its maintenance window, still running in the morning [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/","og_site_name":"dbi Blog","article_published_time":"2020-08-13T16:09:21+00:00","article_modified_time":"2025-10-01T09:46:57+00:00","og_image":[{"width":517,"height":254,"url":"http:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png","type":"image\/png"}],"author":"Microsoft Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Microsoft Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/"},"author":{"name":"Microsoft Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"headline":"SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption","datePublished":"2020-08-13T16:09:21+00:00","dateModified":"2025-10-01T09:46:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/"},"wordCount":602,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png","keywords":["memory consumption","SQL Server","SQLCONNECTIONPOOL"],"articleSection":["Database Administration &amp; Monitoring","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/","url":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/","name":"SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png","datePublished":"2020-08-13T16:09:21+00:00","dateModified":"2025-10-01T09:46:57+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/ressource_semaphore.png","width":517,"height":254},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-high-sqlconnectionpool-memory-clerk-consumption\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Server: High SQLCONNECTIONPOOL Memory Clerk consumption"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4","name":"Microsoft Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","caption":"Microsoft Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/14479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=14479"}],"version-history":[{"count":2,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/14479\/revisions"}],"predecessor-version":[{"id":40593,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/14479\/revisions\/40593"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/14480"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=14479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=14479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=14479"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=14479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}