As you know there is a great toolset named “MySQL Utilities”, which you can use for solving
various administrative tasks.
mysqldiskusage utility is for calculating MySQL Server’s disk
usage and generating informative reports.
Of course this project is open source and everybody could review
the source code.
A few words about how mysqldiskusage calculates database disk
usage will be crucial for understanding algorithm.
The source tree is:
mysql-utilities-1.5.4/scripts/mysqldiskusage.py
If you open this Python file you will see (line 169-175) :
# We do database disk usage by default. try: diskusage.show_database_usage(servers[0], datadir, args, options) except UtilError: _, e, _ = sys.exc_info() print("ERROR: %s" % e.errmsg) sys.exit(1)
By …
[Read more]