Question
Why is the size of database shown in Home > Domains > example.com > View More Statistics different from Home > Domains > example. com > Databases tab > example_db in case the MySQL/MariaDB database uses InnoDB engine?
Answer
Such a difference 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/
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.
Warning: During optimization the database will not be accessible.
As a workaround optimize the database tables.