Search This Blog

2023/10/03

MySQL: get size of Database & Table

 Get Size of Database in Mysql


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;


Size of Table in Mysql

SELECT
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema = "MatrimonyDb"
AND table_name = "Country";

No comments:

Post a Comment