{"id":5802,"date":"2016-07-12T05:53:36","date_gmt":"2016-07-12T05:53:36","guid":{"rendered":"https:\/\/bodhost.com\/kb\/?p=5802"},"modified":"2026-02-26T14:03:11","modified_gmt":"2026-02-26T14:03:11","slug":"mysql-high-memory-usage","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/","title":{"rendered":"How to Resolve MySQL High Memory Usage?"},"content":{"rendered":"<p><strong><\/strong><\/p>\r\n<h5 class=\"wp-block-heading\">What is MySQL?<\/h5>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">MySQL is the most popular database used in web applications. It\u2019s free, easy to administer, and is supported by all hosting providers. There\u2019s a common issue that MySQL servers face and that is high server load due to high memory issues.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\"><strong>Why does MySQL consume high memory?<\/strong><\/p>\r\n\r\n\r\n\r\n<ol class=\"wp-block-list\">\r\n<li>Application software like Python, PHP, and JAVA threads utilize more memory when configured improperly or un-optimized queries, complex coding, etc.<\/li>\r\n\r\n\r\n\r\n<li>Improper configuration of MySQL leads to inefficient memory or wastage of memory.<\/li>\r\n\r\n\r\n\r\n<li>If the memory is lower than, required by the processes on the server.<\/li>\r\n<\/ol>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Resolutions to fix MySQL&#8217;s high memory usage \u2013<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Optimization of MySQL settings \u2013<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">MySQL uses memory in two ways:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>One is the memory permanently reserved for its use \u2013<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Known as the Global Buffers category. It is obtained from the operating system during server boot-up and isn\u2019t released to another process.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Requested dynamic memory:<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Thread Buffers are used by MySQL which is the memory that\u2019s requested from the operating system. As when a new query is processed. After the execution of the query, this memory is released back to the operating system.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">This means that the memory usage of MySQL is Global Buffers Plus. The thread buffers along with the maximum number of allowed connections.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">This value needs to be kept below 90% of the server memory for a dedicated database server. In a case of a shared server, it should be kept below 50% of the server memory.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Check some MySQL settings that help in determining the memory usage which will help you to decide its size.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">innodb_buffer_pool_size \u2013 Caching done in the buffer pool for InnoDB storage. The size of the buffer pool plays a key role in system performance. Assigned a value between 50-70 % of the RAM available. If the pool size is too small, it will cause excessive flushing of pages, and if it\u2019s too large. It will lead to swapping due to competition for memory.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">key_buffer_size \u2013 In the case of the MYISAM storage engine. This parameter helps in determining the caching and key_buffer_size needs to be set as per the RAM. Which is approximately 20% of the RAM size.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">max_connections \u2013 To allocate the number of connections possible for MySQL at any instant of time. And to avoid over-loading the server by a single user, max_connections used. Each thread uses a RAM portion for buffers\u2019 allocation. Hence it limits the maximum number of connections based on the size of the RAM.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Approx formula, max_connections = (Available RAM \u2013 Global Buffers) \/ Thread Buffers<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">query_cache_size \u2013 When tables don\u2019t change very often and for which the web server receives many identical queries like a record lookup or a blog. The query cache can be useful. The text of a SELECT statement stored by the query cache together with the corresponding result that was sent to the client. Therefore, this parameter only used for such application servers or otherwise disabled and set to zero for other servers. In order to avoid resource contention, though it\u2019s enabled, the value set to a minimal one of around 10MB.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Blocking Resource Abusers \u2013<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">There a possibility of an abnormally high number of connections getting established in a short time. When a website is under attack. The PROCESSLIST in MySQL used to detect the top users and block access to abusive connections.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Fixing Slow Queries &#8211;<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Find which queries take a long time to execute as these require further optimization for the servers to perform better and are identifiable through the server-query log. More disk reads caused due to slow queries, leading to high memory and CPU usage, affecting the server performance.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Upgrading RAM \u2013<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Though after optimizing database settings, the server constantly routes to using swap memory, it&#8217;s essential that you increase the RAM.<\/p>\r\n<p><strong><\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>What is MySQL? MySQL is the most popular database used in web applications. It\u2019s free, easy to administer, and is supported by all hosting providers. There\u2019s a common issue that&hellip;<\/p>\n<p><a href=\"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[664],"tags":[778,779],"class_list":["post-5802","post","type-post","status-publish","format-standard","hentry","category-web-hosting","tag-mssql-memory-usage","tag-mysql-memory-usage-limit"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Resolve MySQL High Memory Usage?<\/title>\n<meta name=\"description\" content=\"Experiencing high memory usage with MySQL can impact website performance. Learn tips and techniques for troubleshooting and resolving MySQL memory usage issues.\" \/>\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.bodhost.com\/kb\/mysql-high-memory-usage\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Resolve MySQL High Memory Usage?\" \/>\n<meta property=\"og:description\" content=\"Experiencing high memory usage with MySQL can impact website performance. Learn tips and techniques for troubleshooting and resolving MySQL memory usage issues.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-12T05:53:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:03:11+00:00\" \/>\n<meta name=\"author\" content=\"anilr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"anilr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/mysql-high-memory-usage\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/mysql-high-memory-usage\\\/\"},\"author\":{\"name\":\"anilr\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/8871ea0c76482a5a482e48538ae4dbb3\"},\"headline\":\"How to Resolve MySQL High Memory Usage?\",\"datePublished\":\"2016-07-12T05:53:36+00:00\",\"dateModified\":\"2026-02-26T14:03:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/mysql-high-memory-usage\\\/\"},\"wordCount\":643,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"mssql memory usage\",\"mysql memory usage limit\"],\"articleSection\":[\"Web Hosting\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/mysql-high-memory-usage\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/mysql-high-memory-usage\\\/\",\"name\":\"How to Resolve MySQL High Memory Usage?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2016-07-12T05:53:36+00:00\",\"dateModified\":\"2026-02-26T14:03:11+00:00\",\"description\":\"Experiencing high memory usage with MySQL can impact website performance. Learn tips and techniques for troubleshooting and resolving MySQL memory usage issues.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/mysql-high-memory-usage\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/mysql-high-memory-usage\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/mysql-high-memory-usage\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Web Hosting\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/web-hosting\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Resolve MySQL High Memory Usage?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/8871ea0c76482a5a482e48538ae4dbb3\",\"name\":\"anilr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/11307531bf21385b7c7046df25e96e38f4530ef77506385bb9d9c72798e5b284?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/11307531bf21385b7c7046df25e96e38f4530ef77506385bb9d9c72798e5b284?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/11307531bf21385b7c7046df25e96e38f4530ef77506385bb9d9c72798e5b284?s=96&d=mm&r=g\",\"caption\":\"anilr\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/anilr\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Resolve MySQL High Memory Usage?","description":"Experiencing high memory usage with MySQL can impact website performance. Learn tips and techniques for troubleshooting and resolving MySQL memory usage issues.","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.bodhost.com\/kb\/mysql-high-memory-usage\/","og_locale":"en_US","og_type":"article","og_title":"How to Resolve MySQL High Memory Usage?","og_description":"Experiencing high memory usage with MySQL can impact website performance. Learn tips and techniques for troubleshooting and resolving MySQL memory usage issues.","og_url":"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2016-07-12T05:53:36+00:00","article_modified_time":"2026-02-26T14:03:11+00:00","author":"anilr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"anilr","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/"},"author":{"name":"anilr","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/8871ea0c76482a5a482e48538ae4dbb3"},"headline":"How to Resolve MySQL High Memory Usage?","datePublished":"2016-07-12T05:53:36+00:00","dateModified":"2026-02-26T14:03:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/"},"wordCount":643,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["mssql memory usage","mysql memory usage limit"],"articleSection":["Web Hosting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/","url":"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/","name":"How to Resolve MySQL High Memory Usage?","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2016-07-12T05:53:36+00:00","dateModified":"2026-02-26T14:03:11+00:00","description":"Experiencing high memory usage with MySQL can impact website performance. Learn tips and techniques for troubleshooting and resolving MySQL memory usage issues.","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/mysql-high-memory-usage\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Web Hosting","item":"https:\/\/www.bodhost.com\/kb\/category\/web-hosting\/"},{"@type":"ListItem","position":2,"name":"How to Resolve MySQL High Memory Usage?"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/8871ea0c76482a5a482e48538ae4dbb3","name":"anilr","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/11307531bf21385b7c7046df25e96e38f4530ef77506385bb9d9c72798e5b284?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/11307531bf21385b7c7046df25e96e38f4530ef77506385bb9d9c72798e5b284?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/11307531bf21385b7c7046df25e96e38f4530ef77506385bb9d9c72798e5b284?s=96&d=mm&r=g","caption":"anilr"},"url":"https:\/\/www.bodhost.com\/kb\/author\/anilr\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/5802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=5802"}],"version-history":[{"count":7,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/5802\/revisions"}],"predecessor-version":[{"id":12061,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/5802\/revisions\/12061"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=5802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=5802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=5802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}