We currently have a database on our server that seems to be excessively large. We run the following query to see all the databases sizes on our server -
SELECT Round(Sum(data_length + index_length) / 1024 / 1024, 1) 'DB Size in MB' FROM information_schema.tables where table_schema like 'some_db' GROUP BY table_schema;
It returns the following -
+---------------+
| DB Size in MB |
+---------------+
| 23663.4 |
+---------------+
However, we also take nightly backups. Looking at this nightly backup for the specific database, it is only 6.5 GB, rather than the 23 GB that the query is reporting. Every other database that we are checking for appears to be roughly the same.
I saw this - https://stackoverflow.com/questions/4709521/mysql-database-size, however we arent using phpmyadmin to takle the backups. The backups are done inside of a RHEL7 server running MariaDB, and are taken using mysqldump.
The command being run when taking the backup is -
mysqldump -uroot -p --single-transaction some_db > /tmp/somedb_backup.sql