To find Database Size using query in mysql.
The following mysql query is used to find the database size in Mb.
With the use of information_schema we can get it done easily.
SELECT SUM(ROUND(((data_length + index_length) / 1024 / 1024),2)) AS "Size in MB"
FROM information_schema.TABLES WHERE table_schema = "----Your DB Name---";
In this we can also have table wise memory occupation with the use of following query.
SELECT TABLE_NAME, table_rows, data_length, index_length,
ROUND(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = " "----Your DB Name---";
SELECT TABLE_NAME, table_rows, data_length, index_length,
ROUND(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = " "----Your DB Name---";
Thanks,
Ramanavel Selvaraju.
No comments:
Post a Comment