If you need to check a single database, you can quickly find the SQL Server database sizein SQL Server Management Studio (SSMS): Right-click the database and then click Reports -> Standard Reports -> Disk Usage. Alternatively, you can use stored procedures like exec sp_spaceused to get database size.
MyISAM tables have a default limit set to 256TB for data and index files, which you can change to 65,536TB maximum. InnoDB maximum size for tables is 256TB, which corresponds to the full tablespace size.
Determine the size, then the average number of occurrences of each segment type in a database record. By multiplying these two numbers together, you get the size of an average database record.
From S. Prakash, found at the MySQL forum:
SELECT table_schema "database name",
sum( data_length + index_length ) / 1024 / 1024 "database size in MB",
sum( data_free )/ 1024 / 1024 "free space in MB"
FROM information_schema.TABLES
GROUP BY table_schema;
Or in a single line for easier copy-pasting:
SELECT table_schema "database name", sum( data_length + index_length ) / 1024 / 1024 "database size in MB", sum( data_free )/ 1024 / 1024 "free space in MB" FROM information_schema.TABLES GROUP BY table_schema;
You can get the size of your Mysql database by running the following command in Mysql client
SELECT sum(round(((data_length + index_length) / 1024 / 1024 / 1024), 2)) as "Size in GB"
FROM information_schema.TABLES
WHERE table_schema = "<database_name>"
If you use phpMyAdmin, it can tell you this information.
Just go to "Databases" (menu on top) and click "Enable Statistics".
You will see something like this:
This will probably lose some accuracy as the sizes go up, but it should be accurate enough for your purposes.
if you want to find it in MB do this
SELECT table_schema "DB Name",
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;
Basically there are two ways: query DB (data length + index length) or check files size. Index length is related to data stored in indexes.
Everything is described here:
http://www.mkyong.com/mysql/how-to-calculate-the-mysql-database-size/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With