使用 information_schema.TABLES 表可以查询数据库、表、索引的容量大小。 通过添加 WHERE 子句和 ORDER BY 子句,可以灵活地筛选和排序查询结果。
使用information_schema 库中的 Table 表,你可以查询数据库、表、索引的容量大小。更多有关information_schema 的信息,MySQL 手册中有深入介绍。查询时请注意,data_length、index_length字段存储的容量信息单位为字节,需要除以 2 个 1024 转换为 MB。以下是查询步骤:1. 查看所有库的容量大小 2. 查看...
1、查询整个mysql数据库,整个库的大小;单位转换为MB。select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from information_schema.TABLES 2、查询mysql数据库,某个库的大小;select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from information_schema.TABLES...
1、进入information_schema 数据库(存放了其他的数据库的信息)use information_schema;2、查询所有数据的大小:select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;3、查看指定数据库的大小:比如查看数据库home的大小 select concat(round(sum(data_length/1024/1024),2...
在备份数据库时,需了解数据库所占磁盘空间。通过SQL查询,能获得数据库总容量及表具体容量。查询单表容量,即合并表数据与索引。查询所有数据大小,需访问mysql元数据数据库information_schema。information_schema包含多个表,如schemata表记录所有数据库信息,tables表存储各表信息,columns表存储表字段信息等...