一、查询某实例下所有数据库的容量大小(单位:G)

sql语句:

use information_schema;查看mysql数据库指定库或指定表的容量大小
        select concat(round(sum(data_length/1024/1024/1024),2),'G')  from tables;  #查询所有库的容量大小查看mysql数据库指定库或指定表的容量大小

二、查询指定数据库、指定表的容量大小(单位:MB)

use information_schema;

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from information_schema.tables where table_schema={库名};use information_schema;
查看mysql数据库指定库或指定表的容量大小查看mysql数据库指定库或指定表的容量大小

三、查询指定数据库、指定表的行数

use information_schema;

SELECT sum(TABLE_ROWS) FROM information_schema.tables where table_schema={库名} and TABLE_NAME ={表名};查看mysql数据库指定库或指定表的容量大小

相关文章:

  • 2022-01-26
  • 2021-11-29
  • 2021-08-26
  • 2021-07-31
  • 2022-12-23
  • 2021-06-17
  • 2021-11-18
猜你喜欢
  • 2021-11-29
  • 2021-10-03
  • 2021-11-29
  • 2021-12-02
相关资源
相似解决方案