Posts MySQL count filesize of database
Post
Cancel

MySQL count filesize of database

//https://www.a2hosting.com/kb/developer-corner/mysql/determining-the-size-of-mysql-databases-and-tables

1
2
3
4
5
6
7
8
9
10
11
12
//whole dbase
SELECT table_schema AS "Database", 
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)" 
FROM information_schema.TABLES 
GROUP BY table_schema;

//specific catalog
SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "database_name"
ORDER BY (data_length + index_length) DESC;

origin - https://www.pipiscrew.com/?p=18990 mysql-count-filesize-of-database

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags