MySQL queries the storage usage size of the entire database, the specified database, and the specified table


1: Query the entire database, the size of the entire database; the unit is converted to G:

 select concat(round(sum(DATA_LENGTH/1024/1024/1024),2),'G') as data  from information_schema.TABLES;

 

2: Query the mysql database, the size of a certain database:

select concat(round(sum(DATA_LENGTH/1024/1024/1024),2),'G') as data  from information_schema.TABLES where   table_schema = 'cxm_service_data_base';

 

3: View the size of a table in the library:

select concat(round(sum(DATA_LENGTH/1024/1024/1024),2),'G') as data  from information_schema.TABLES where table_schema = 'cxm_service_data_base' and table_name = 'dk_sale_order_head';


 

Guess you like

Origin blog.csdn.net/Crystalqy/article/details/108851027