Forum Stats

  • 3,853,894 Users
  • 2,264,290 Discussions


Memory leak caused by query table meta data?

edited May 17, 2016 4:59PM in MySQL Community Space

Hi there,

We know that normally Mysql is good at controlling memory usage but the problem we are seeing is a bit suspicious. I want to ask for help to see whether somebody can help on debugging the issue. Feel free to let me know if there are more details needed.

The databases we have are all in InnoDB. There are around 4400 tables in a database. Lots of tables are partitioned by yearweek and having more than 50 partitions.

How to reproduce the issue:

1) We have a script to monitor table schema and create partitions. While running it, we found running 'SHOW CREATE TABLE xxx' on each table will make Mysql take more and more memory. After scanning all of the tables, mysql has started using more than 1GB swap.

2) We had a migration recently to add a column to half of the tables we have. The query is like 'ALTER ONLINE TABLE table_name ADD COLUMN IF NOT EXISTS (`col` smallint(3) DEFAULT NULL)' and it was in one thread to migration the tables one by one. The memory usage keeps increasing and start to swap as well.


Mariadb 10.0.20 running on 64 bit CentOS6.7. 7GB RAM, 8GB swap. vm.swappiness = 30. The Mariadb is built with tcmalloc.

innodb-buffer-pool-size         = 2G

innodb-buffer-pool-instances    = 2

innodb-additional-mem-pool-size = 20M

innodb-log-buffer-size          = 4M

innodb-thread-concurrency       = 4

innodb-file-format              = Barracuda

innodb-file-per-table           = 1

query-cache-type                = 1

query-cache-size                = 16M

thread-cache-size               = 64

table-open-cache                = 1024

table-definition-cache          = 2048



***Moderator action (Timo): removed the private contact data. User please don't post this kind of information here in this public forum.***


Best Answer