Problem
- The size of database shown in Home > Domains > example.com > View More Statistics different from Home > Domains > example. com > Databases tab > example_db
- The MySQL/MariaDB database uses InnoDB engine
Cause
The cause is MySQL bug #1341 in which the ibdata (ibd) files grows as it keeps the information about data even after it was deleted from the database.
The bug on the MariaDB side is available here.
The difference in file size is expected for MySQL and MariaDB databases using InnoDB storage engine, because the size in Databases tab is taken from the information_schema
table, which is the real size of the database itself and View More Statistics shows the actual size of the /var/lib/mysql/example_db/
directory in the file system:
# du -sh /var/lib/mysql/example_db/
269M /var/lib/mysql/example_db/
Resolution
As a workaround optimize the MySQL database tables.
Warning: During the optimization of following the database will not be accessible.