zlzyp 发表于 2018-10-5 08:13:57

MySQL统计库或表大小

  mysql查看当前所有的数据库和索引大小
  select table_schema, concat(truncate(sum(data_length)/1024/1024,2),' mb') as data_size,
  concat(truncate(sum(index_length)/1024/1024,2),'mb') as index_size
  from information_schema.tables
  group by table_schema
  order by data_length desc;
  mysql查看当前某个数据库和数据库下所有的表的大小
  select table_name, concat(truncate(data_length/1024/1024,2),' mb') as data_size,
  concat(truncate(index_length/1024/1024,2),' mb') as index_size
  from information_schema.tables where table_schema = 'mysql'
  group by table_name
  order by data_length desc;

页: [1]
查看完整版本: MySQL统计库或表大小