<img height="1" width="1" style="display:none;" alt="" src="https://dc.ads.linkedin.com/collect/?pid=204641&amp;fmt=gif">

What’s the Size of Your Database Instances? MySQL Edition

Posted by Lukas Vileikis on Oct 13, 2021 8:47:00 AM

If you are a database administrator, you are probably already keeping an eye out on your database instances as it is. You probably already know how important it is to monitor the performance of your database instances; you know how to optimize your database instances for high availability, security, performance, you know how to deal with capacity issues too. 

However, what’s also worth discussing is the actual size of your database instances: do you know what data your database instances hold? How much of it is necessary? How much of it isn’t? 

----------------------------------------------------------------------------------------------------------

 5-Aug-16-2021-06-50-21-12-AM

 

Why Monitor the Size of Your Database Instances? 


If you find yourself working with databases, you are probably already monitoring many a bunch of things: you might find yourself asking, why do you need to monitor one additional thing? What’s the use of doing so? 

In this case, monitoring the size of your database instances might be very useful for a bunch of reasons: 

1. You are at less risk of running out of disk space because you are always aware of how much disk space is occupied and how much disk space is available. 

2. You are able to quickly observe data-related anomalies and protect your database from upcoming issues. 

3. You are can see what’s necessary to use and what’s not: for example, do you really need that index you added a week ago? Do you need to partition your data to increase SELECT query performance if the total size of your database instances is under 1GB? Are you following good data storage, disk capacity, and security practices? etc. 
 
 

How to Monitor the Size of Your MySQL Database Instances? 

We have discussed the importance of monitoring the size of your disk and memory usage. Still, we haven’t dug deeper into monitoring the size of your database instances, and especially MySQL, as a whole. If you are a database-conscious developer or a SQL Server or MySQL DBA yourself, you probably already know how to monitor the size of your SQL Server or MySQL instances. If you don’t, however, and find yourself wanting to figure out how that’s done, it’s really not that hard as it might seem. Launch dbWatch and import a database instance. Then expand the Availability section: 

 
 
You should see a database-related job called “MySQL Space Optimizer”: run it, then observe its details (in this case, our MySQL instance is almost empty, hence the "0" under the total data length in MB):
 
 
This job can also be configured - click Configure and modify it according to your needs: 
 

 

As you can see, you can also set the measure of your data size (Bytes, KB, MB or GB if your data set is large enough) You can even check the size of tables in a specific database: should you want to do so, enter the name of the database next to the “table_schema” parameter. Happy optimizing! 

 

Observing the Growth Rate of Your Database Instances 

The MySQL space optimizer can be very useful if you want to know how much space tables in a specific database consume. However, what you might also want to keep an eye on, is the growth rate of your database instances. In that case, keep an eye on the database growth rate jobs. Those kinds of jobs can either be aggregated (provides less information)  or detailed (provides more information): for example, run the aggregated database growth rate job, and you will be able to see the following: 

This dbWatch job provides you with your database growth rate. In this case, the job also allows us to see how big our database instance is at a given time. We can observe the size of our data existing in our SQL database instances, the size of our indexes and the total size of everything in our database instance combined. Should you want to take a deeper dive, there’s also a detailed database growth job available for you to use too – run it and observe the details: 

 

 

In this casedbWatch provides you with the growth rate of the largest database on your server: keeping an eye out for this database job can be beneficial when your company is dealing with large datasets.

 

Summary

If you are a MySQL, MariaDB ,or SQL Server DBA, you probably know that neglecting to monitor the size of your database could be harmful to a business. If your company runs out of disk space, what do you do then? It is better to come up with a plan beforehand than make something work at the last minute. We hope that this blog post has given you some insight into how you should go about monitoring the size of your MySQL database instances. However, if something is still not clear, head over to the documentation or contact support to learn more: they will be more than happy to help you out. 

 

 ----------------------------------

Other blogs:

MySQL Connections

Database Uptime 101

 

 ----------------------------------

 

About the Author:

Lukas Vileikis is an ethical hacker and a frequent conference speaker.

Since 2014, Lukas has found and responsibly disclosed security flaws in some of the most visited websites in Lithuania.

He runs one of the biggest & fastest data breach search engines in the world - BreachDirectory.com, frequently speaks at conferences and blogs in multiple places including his blog over at lukasvileikis.com.

 

Topics: database dashboard, database operations, sql server monitoring, sql monitoring tools, database monitoring, sqlmonitor, sqlperformance, sqlmanager, database farm, farmmanagement