MySQL DB fast grow: how to free space ??

Started by radw, May 03, 2016, 06:11:47 PM

Previous topic - Next topic

radw

Hello, I just finished yesterday my issue with DCIs, when I found that the db and hdd usage of my debian system where I mounted NetXMS grow very fast in less than 1 week. When I installed the fresh debian and NetXMS, the disk spase was almost 12% (of 30GB), and yesterday, the usage was in 63% !!:



mysql> SELECT table_schema "Database Name", SUM(data_length+index_length)/1024/1024
    -> "Database Size (MB)"  FROM information_schema.TABLES GROUP BY table_schema;
+--------------------+--------------------+
| Database Name      | Database Size (MB) |
+--------------------+--------------------+
| information_schema |         0.00878906 |
| mysql              |         0.67379189 |
| netxms             |     12664.09375000 |
| performance_schema |         0.00000000 |
+--------------------+--------------------+
4 rows in set (15.80 sec)

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        29G   17G   10G  63% /




I suspect first of the DCI tables that I had in retention mode of 30 days, and I changed it to dont store in db, and also did "Clear collected data" on the DCI but the size didnt decrease. I also run nxdbmgr check and nothing, then I deleted the tables and nothing.

Is there any that I can do to free all that space taken for the db without forcing drop the db??. With this I learned that dci tables take a lot of db space and the next time I put in retention mode: not store in db.

Regards.

Tursiops

If the issue is the increase in disk space usage and MySQL not freeing up space, I'm guessing this is InnoDB.
Depending on your settings, you may be able to reclaim the space. See the following link for some background and details:
https://www.percona.com/blog/2013/09/25/how-to-reclaim-space-in-innodb-when-innodb_file_per_table-is-on/

In regards to how quickly the database grows, that would really depend on how much you are monitoring, how often you are checking and indeed your retention.

For comparison purposes:
With our current setup, we have around 15k DCIs (some monitored per minute, some per hour) and 80 GB of disk space in use. And retention for most items currently goes back maybe 2 months. So if you monitor a lot and want the retention, I recommend more disk space. :)