mysql 查看数据库索引 和 数据 大小


查看数据概况
 select * from information_schema.TABLES 
  where information_schema.TABLES.TABLE_SCHEMA='business_shop2'
  and information_schema.TABLES.TABLE_NAME='ls_prod'
 


查看索引大小

 select CONCAT(ROUND(SUM(t.index_length)/(1024*1024), 2), ' MB') AS 'Total Index Size' from (
 select index_length from information_schema.TABLES 
  where information_schema.TABLES.TABLE_SCHEMA='business_shop2'
  and information_schema.TABLES.TABLE_NAME='ls_prod' ) as t 


查看数据大小
   select CONCAT(ROUND(SUM(t.data_length)/(1024*1024), 2), ' MB') AS 'Total data Size' from (
 select data_length from information_schema.TABLES 
  where information_schema.TABLES.TABLE_SCHEMA='business_shop2'
  and information_schema.TABLES.TABLE_NAME='ls_prod' ) as t 

你可能感兴趣的:(mysql,索引大小,数据大小)