包含标签:大小 的文章
  • mysql 查看表数据大小条数

    mysql的information_schema库重 tables存储了数据表的元数据信息,下面是其中几个字段的含义: table_schema: 记录数据库名; table_name: 记录数据表名; table_rows: 关于表的粗略行估计; data_length : 记录表的大小(单位字节); index_length : 记录表的索引的大小; 要查看表的大小,条数,可以查data_length,table_rows select TABLE_NAME, concat(truncate(data_length/1024/1024,2),' MB') as data_size,table_rows from information_schema.tables where TABLE_SCHEMA = 'dbName' and TABLE_NAME in ("tableName1","tableName2")  

    SE_Zhang 2024-04-11
    12 0 0
  • MySQL查看数据库及表容量大小并排序

    查看所有数据库容量大小 select table_schema as '数据库', sum(table_rows) as '记录数', sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)', sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)' from information_schema.tables group by table_schema order by sum(data_length) desc, sum(index_length) desc;   查看所有数据库各表容量大小 select table_schema as '数据库', table_name as '表名', table_rows as '记录数', truncate(data_length/1024/1024, 2) as '数据容量(MB)', truncate(index_length/1024/1024, 2) as '索引容量(MB)' from information_schema.tables order by data_length desc, index_length desc;   查看指定数据库容量大小 查看your_table_name表 select table_schema as '数据库', sum(table_rows) as '记录数', sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)', sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)' from information_schema.tables where table_schema='your_table_name'; 查看指定数据库各表容量大小 查看your_table_name表 select table_schema as '数据库', table_name as '表名', table_rows as '记录数', truncate(data_length/1024/1024, 2) as '数据容量(MB)', truncate(index_length/1024/1024, 2) as '索引容量(MB)' from information_schema.tables where table_schema='your_table_name' order by data_length desc, index_length desc;  

    SE_Gao 2024-02-23
    25 0 0
  • MySQL查看数据库表容量大小

      本文介绍MySQL查看数据库表容量大小的命令语句,提供完整查询语句及实例,方便大家学习使用。 1. 查看所有数据库容量大小 select table_schema as '数据库', sum(table_rows) as '记录数', sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)', sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)' from information_schema.tables group by table_schema order by sum(data_length) desc, sum(index_length) desc;   2. 查看所有数据库各表容量大小 select table_schema as '数据库', table_name as '表名', table_rows as '记录数', truncate(data_length/1024/1024, 2) as '数据容量(MB)', truncate(index_length/1024/1024, 2) as '索引容量(MB)' from information_schema.tables order by data_length desc, index_length desc;   3. 查看指定数据库容量大小 例:查看mysql库容量大小 select table_schema as '数据库', sum(table_rows) as '记录数', sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)', sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)' from information_schema.tables where table_schema='mysql';   4. 查看指定数据库各表容量大小 例:查看mysql库各表容量大小 select table_schema as '数据库', table_name as '表名', table_rows as '记录数', truncate(data_length/1024/1024, 2) as '数据容量(MB)', truncate(index_length/1024/1024, 2) as '索引容量(MB)' from information_schema.tables where table_schema='mysql' order by data_length desc, index_length desc;    

    SE_Gao 2024-02-21
    18 0 0