Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check memory used by each database/tables in mysql using command prompt?

I've two or more databases in my mysql server. Total memory used by the databases are around 14GB. I want to know, memory used by each database and their tables.

like image 645
Rads Avatar asked Jan 12 '23 17:01

Rads


1 Answers

This should work

SELECT table_schema "table name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" 
FROM information_schema.TABLES GROUP BY table_schema ; 

It will display the database sizes in two column format => | database name | database size |

like image 163
Harsha Venkatram Avatar answered Jan 31 '23 05:01

Harsha Venkatram