暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

GBase 8a数据库中建表注意事项分析

原创 GBASE数据库 2026-08-12
14

文章配图-1

南大通用GBase 8a数据库(gbase database)作为MPP 数据库,分布列的选择尤其重要,对性能影响在某些情况下能达到1~2个量级。 选择合适的建表语句,对业务来说至关重要。

一、建表范例create table t_hash_bigtable(id int,name varchar(10)) compress('STDZ',0) distributed by ('id'); -- 分布表,分布列是id。create table t_hash_smalltable(id int,name varchar(10)) compress('STDZ',0) replicated; -- 复制表切换库:use test ;看表列: desc t_hash_bigtable;看表创建语句: show create table test.t_hash_bigtable ; show create table test.t_hash_smalltable;

修改分布列:需要转储,如修改上面 t_hash_bigtable 。alter table t_hash_bigtable rename to t_hash_bigtable_old;create table t_hash_bigtable distributed by ('name') compress ('STDZ',0) as select * from t_hash_bigtable_old limit 10;-- 没问题后 drop table t_hash_bigtable_old;

二、建表说明

大表创建为分布表,分布列选择用于join的,重复值较低的列; 小表创建为复制表,一般数据量低于10万;表压缩,使用 STDZ,0 。默认不指定压缩走55压缩,大概1T数据压缩后200GB,STDZ压缩后做的,大概120GB。

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论