南大通用GBase 8a 通过系统表查看table占用空间容量大小

原文链接:www.gbase.cn/community/p...

更多精彩内容尽在南大通用GBase技术社区,南大通用致力于成为用户最信赖的数据库产品供应商。

通过系统表查看表占用磁盘空间大小

可以通过 information_schema.cluster_tables 表的 TABLE_DATA_SIZE 和TABLE_STORAGE_SIZE字段进行统计,具体统计方法如下:

TABLE_DATA_SIZE 是数据存储空间(主备分片之和)

TABLE_STORAGE_SIZE 是数据存储空间+元数据存储空间(主备分片之和)

以本地虚拟机2节点集群 p 2 d 1 配置为例,创建hash分布表test:

sql 复制代码
   CREATE TABLE "test" ("a" int(11) DEFAULT NULL) DISTRIBUTED BY('a'); 插入数据并翻倍到83886080条记录。
   
   gbase> select TABLE_NAME,TABLE_DATA_SIZE,TABLE_STORAGE_SIZE from information_schema.cluster_tables where table_schema='lz' and table_name='test';
   +------------+-----------------+--------------------+
   | TABLE_NAME | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE |
   +------------+-----------------+--------------------+
   | test       |         1571972 |            1846824 |
   +------------+-----------------+--------------------+

1)TABLE_DATA_SIZE 计算

ruby 复制代码
[gbase@node1 test_n2]$ pwd
/opt/gnode/userdata/gbase/lz/sys_tablespace/test_n2
[gbase@node1 test_n1]$ du -csb *
104428 C00000.seg
209177 C00000.seg.1
313605 total
[gbase@node1 test_n1]$ cd ../test_n2/
[gbase@node1 test_n2]$ du -csb *
157454 C00000.seg
314927 C00000.seg.1
472381 total

(313605+472381)*2=1571972(TABLE_DATA_SIZE

2)TABLE_STORAGE_SIZE 计算

再计算元数据空间

css 复制代码
[gbase@node1 test_n1.GED]$ pwd
/opt/gnode/userdata/gbase/lz/metadata/test_n1.GED
[gbase@node1 test_n1.GED]$ du -csb *
128 C00000.ctl.A
128 C00000.ctl.B
54325 C00000.map
230 table.des.A
230 table.des.B
52 table.state.A
52 table.state.B
55145 total
[gbase@node1 test_n1.GED]$ cd ../test_n2.GED/
[gbase@node1 test_n2.GED]$ du -csb *
128 C00000.ctl.A
128 C00000.ctl.B
81461 C00000.map
230 table.des.A
230 table.des.B
52 table.state.A
52 table.state.B
82281 total

(55145 + 82281)*2 + 1571972(TABLE_DATA_SIZE=1846824 (TABLE_STORAGE_SIZE

原文链接:www.gbase.cn/community/p...

更多精彩内容尽在南大通用GBase技术社区,南大通用致力于成为用户最信赖的数据库产品供应商。

相关推荐
angushine1 小时前
Windows版本PostgreSQL定时备份
数据库·windows·postgresql
roman_日积跬步-终至千里1 小时前
【系统架构设计(38)】数据库规范化理论
数据库·系统架构
YDS8291 小时前
MYSQL —— 约束和多表查询
数据库·mysql
The star"'1 小时前
MariaDB数据库管理
数据库·mariadb
无名指的等待7122 小时前
Redisson的Lock和TryLock的区别
java·开发语言·数据库
码农学院3 小时前
Excel批量导入到数据库的方法
数据库·oracle·excel
曾经的三心草3 小时前
实验指导-基于阿里云函数计算的简单邮件发送服务 之数据库访问中间件
数据库·阿里云·中间件
RestCloud3 小时前
MongoDB到关系型数据库:JSON字段如何高效转换?
数据库·mysql·mongodb
洲覆3 小时前
Redis 64字节分界线与跳表实现原理
数据结构·数据库·redis·缓存
失因3 小时前
Nginx 特性、配置与实战部署
运维·数据库·nginx