Why our Control Panel Can Show a Different Size of a Database Compared to phpMyAdmin

Some of our customers have experienced that our Control Panel and the size metric in phpMyAdmin can differ quite a lot from time to time. Some times showing a size 4-5x larger in our Control Panel compared to phpMyAdmin. This has a simple explanation.

Actual disk space used and the calculated metric in phpMyAdmin is two different things

The disk space metrics shown in our Control Panel is actual space used on disk, compared to the phpMyAdmin metric which calculated the size of the actual data and indexes in the database. If you have a high volume of writes/deletes the actual size on disk can grow even though phpMyAdmin is quite steady.

Solved my optimising the tables

This problem has a simple solution, and it is to run optimize table on all tables in the database.
Warning! Do not run optimize table when you have high traffic on your site

Solution for WordPress

If you have a WordPress site, this is solved easily by running WP CLI command wp db optimize (https://developer.wordpress.org/cli/commands/db/optimize/)

Not running WordPress? Here is a step by step guide for non-WordPress:

  1. Log in to the database using phpMyAdmin at a time of low traffic on your site.
  2. Choose the database and click to see it’s structure
  3. Select all tables
  4. In the dropdown select field at the bottom of the structure table choose Optimize table and wait for it to finish
  5. Wait a up to 10 minutes for the Control Panel to receive a disk space quota update and verify that this solved the problem