deprecation
db:size is deprecated.
upsun db:size --help
Command: db:size
Description: DEPRECATED Estimate the disk usage of a database
The original purpose of db:size was to report disk usage of the database at a time when we didn't have actual disk access. Sadly especially on older mariadb databases this can be off by several 100s of MB compared to real disk usage.
disk usage is now reported accurately with upsun disk which checks the actual file system in stead of asking the database server.
move db:size --cleanup to it's own db:cleanup
We will remove this option at some point, but we need to move the db:size --cleanup option elsewhere because this is something we want to keep. A logical place to move it is db:cleanup
function (see code, but summed up here)
cleanup will go through the tables and check if there is unallocated space and propose to recreate the tables that have a large percentage of unallocated space. Innodb does not automatically reclaim it and it can run databases out of disk space if a project is doing a lot of DELETE and INSERT on the same table.
documentation
After this change it is important that we also change communication and documentation on this. For example here: https://developer.upsun.com/posts/insights/the-mystery-of-the-shrinking-database-dump
side note
Maybe we should even consider running automated cleanup as part of our periodic-maintenance, but that's another discussion.
deprecation
db:size is deprecated.
The original purpose of db:size was to report disk usage of the database at a time when we didn't have actual disk access. Sadly especially on older mariadb databases this can be off by several 100s of MB compared to real disk usage.
disk usage is now reported accurately with
upsun diskwhich checks the actual file system in stead of asking the database server.move db:size --cleanup to it's own db:cleanup
We will remove this option at some point, but we need to move the
db:size --cleanupoption elsewhere because this is something we want to keep. A logical place to move it isdb:cleanupfunction (see code, but summed up here)
cleanup will go through the tables and check if there is unallocated space and propose to recreate the tables that have a large percentage of unallocated space. Innodb does not automatically reclaim it and it can run databases out of disk space if a project is doing a lot of DELETE and INSERT on the same table.
documentation
After this change it is important that we also change communication and documentation on this. For example here: https://developer.upsun.com/posts/insights/the-mystery-of-the-shrinking-database-dump
side note
Maybe we should even consider running automated cleanup as part of our periodic-maintenance, but that's another discussion.