# MySQL using 90% memory

**URL:** <https://forums.percona.com/t/mysql-using-90-memory/3281>\
**Category:** Other MySQL® Questions\
**Created:** [February 17, 2014, 1:04pm UTC](https://forums.percona.com/t/mysql-using-90-memory/3281 "2014-02-17T13:04:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvguy](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jvguy](https://forums.percona.com/u/jvguy)\
**Post date:** [February 17, 2014, 1:04pm UTC](https://forums.percona.com/t/mysql-using-90-memory/3281/1 "2014-02-17T13:04:27Z")

</div>

We are using Percona 5.6 in our production environment. The database is more read intensive but no read replica’s has been setup yet but that is one of the thing in our TODO list.

Last week I was checking memory usage and I observed that MySQL was using more than 85% of memory but I did not seen any performance depletion due to high memory usage. Is it normal for MySQL to claim maximum Memory but not actually using those memory?

What is the best way to see how MySQL is allocating its memory? Please sherd some light to me.

---

<div class="post-metadata">

**Author:** ![cetanhota](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@cetanhota](https://forums.percona.com/u/cetanhota)\
**Post date:** [February 18, 2014, 2:08pm UTC](https://forums.percona.com/t/mysql-using-90-memory/3281/2 "2014-02-18T14:08:40Z")

</div>

You can use this procedure to see how much total memory MySQL will use.  
DELIMITER $$  
CREATE DEFINER=`root`@`%` PROCEDURE `MaxMemoryUsed`()  
begin  
/\*  
Written By:  
Date: 10/15/2012  
This procedure will provide the total amount of memory that mysql  
will used based on memory config settings.  
\*/  
SET @kilo\_bytes = 1024;  
SET @mega\_bytes = @kilo\_bytes \* 1024;  
SET @giga\_bytes = @mega\_bytes \* 1024;

select (@@key\_buffer\_size + @@query\_cache\_size + @@tmp\_table\_size+@@innodb\_buffer\_pool\_size + @@innodb\_additional\_mem\_pool\_size + @@innodb\_log\_buffer\_size + @@thread\_stack +  
@@max\_connections \* (@@read\_buffer\_size + @@read\_rnd\_buffer\_size + @@sort\_buffer\_size + @@join\_buffer\_size +  
@@binlog\_cache\_size + @@thread\_stack)) / @mega\_bytes as ‘Max\_Memory\_in\_Megs’;  
end$$  
DELIMITER ;

---

<div class="post-metadata">

**Author:** ![niljoshi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/niljoshi/32/16889_2.png) [@niljoshi](https://forums.percona.com/u/niljoshi)\
**Post date:** [February 24, 2014, 1:37am UTC](https://forums.percona.com/t/mysql-using-90-memory/3281/3 "2014-02-24T01:37:28Z")

</div>

Hi,

I would suggest you to read my blog post about how to troubleshoot the memory usage in MySQL. You’ll get many ways to figure out where memory is allocating.  
[url][http://www.mysqlperformanceblog.com/2014/01/24/mysql-server-memory-usage-2/[/url]](http://www.mysqlperformanceblog.com/2014/01/24/mysql-server-memory-usage-2/%5B/url%5D)
