云数据库 GAUSSDB(FOR MYSQL)-查看GaussDB(for MySQL)的存储容量:通过命令查看存储容量
通过命令查看存储容量
连接 GaussDB (for MySQL)数据库后,执行如下命令查看存储容量。
show spaceusage;
上述命令查询到的存储容量值等于表数据、表预分配空间、分区预分配空间、Binlog、Redolog和undo space之和,详情请参见表1。
information_schema信息不是实时刷新的,查询之前可以先执行如下命令进行刷新:
set information_schema_stats_expiry = 0;
条目 |
查看方式 |
说明 |
---|---|---|
表数据 |
select sum(data_length+index_length+data_free) from information_schema.tables; |
传统MySQL的容量计算方式,该语句依赖统计数据的精准度,在统计数据未更新时可能会有偏差。 |
表预分配空间 |
select count(*) from information_schema.tables; |
每张表会预分配4MB空间,该语句查询出表的数量乘以4MB就是总的表预分配空间。 |
分区预分配空间 |
select count(*) from INFORMATION_SCHEMA.PARTITIONS where PARTITION_NAME is not null; |
每个分区会预分配4MB空间,该语句查询出分区的数量乘以4MB就是总的分区预分配空间。 |
Binlog |
show binary logs; |
将所有binlog的文件大小相加。 |
Redolog |
show lsninfo; |
flushed_to_disk_lsn- truncate_lsn |
undo space |
select sum(INITIAL_SIZE) as undo_space from information_schema.files where file_type='UNDO LOG '; |
undo空间。 |
- MySQL创建数据库命令_MySQL查看数据库命令_如何安装MySQL数据库
- GaussDB(for MySQL)规格变更_包周期库扩容_变更CPU_存储扩容
- GaussDB(for MySQL)并行查询_GaussDB(for MySQL)内核_GaussDB(for MySQL)并行执行_PQ
- 云数据库GaussDB(for MySQL)_兼容MySQL
- 云数据库 GaussDB(for MySQL)与RDS for MySQL的区别
- GaussDB(for MySQL)包周期容量变更_包周期库扩容_变更CPU_存储扩容
- 连接GaussDB(for MySQL)数据库_华为云数据库GaussDB(for MySQL)_数据库连接
- GaussDB查看表字段_GaussDB查看表所在节点_高斯数据库查看表字段-华为云
- GaussDB查看表大小_GaussDB查询表空间_高斯数据库查看表大小-华为云
- 灾备应用场景_数据异地容灾备份_云备份免费试用