当前位置:网站首页>gbase8s创建RANGE分片表
gbase8s创建RANGE分片表
2022-08-04 18:15:00 【wangwei830】
创建RANGE分片表
CREATE TABLE employee
(
id INTEGER,
name CHAR(32),
basepay DECIMAL (10,2),
varpay DECIMAL (10,2),
dept CHAR(2),
hiredate DATE)
FRAGMENT BY RANGE (id)
INTERVAL (100) STORE IN (datadbs01)
PARTITION p0 VALUES IS NULL IN datadbs01,
PARTITION p1 VALUES < 200 IN datadbs01,
PARTITION p2 VALUES < 400 IN datadbs01;
插入数据
drop procedure IF EXISTS proc8;
create procedure proc8(p_in int) ;
define i int;
let i = 1;
while(i<=p_in) loop
insert into employee values(
i,
'aa',
3.14,
31.4,
'bb',
current
);
exit when i = p_in;
let i = i + 1;
end loop;
end procedure;
分片结果
#分片表达式
FRAGMENT BY RANGE (id)
INTERVAL (100) STORE IN (datadbs01)
PARTITION p0 VALUES IS NULL IN datadbs01,
PARTITION p1 VALUES < 200 IN datadbs01,
PARTITION p2 VALUES < 400 IN datadbs01;
#执行这样两次插入
> call proc8(10);
> call proc8(1000);
#结果如下:
gbasedbt[hdr2]$oncheck -pt db01:employee |grep partitio
Table fragment partition p0 in DBspace datadbs01
Table fragment partition p1 in DBspace datadbs01
Table fragment partition p2 in DBspace datadbs01
Table fragment partition sys_p3 in DBspace datadbs01
Table fragment partition sys_p4 in DBspace datadbs01
Table fragment partition sys_p5 in DBspace datadbs01
Table fragment partition sys_p6 in DBspace datadbs01
Table fragment partition sys_p7 in DBspace datadbs01
Table fragment partition sys_p8 in DBspace datadbs01
Table fragment partition sys_p9 in DBspace datadbs01
gbasedbt[hdr2]$
gbasedbt[hdr2]$oncheck -pt db01:employee |grep "Number of rows"
Number of rows 0
Number of rows 209
Number of rows 200
Number of rows 100
Number of rows 100
Number of rows 100
Number of rows 100
Number of rows 100
Number of rows 100
Number of rows 1
gbasedbt[hdr2]$
#这个一行数据是1000
gbasedbt[hdr2]$oncheck -pP 3 4928
addr stamp chksum nslots flag type frptr frcnt next prev
3:4928 402653 3798 1 801 DATA 78 16298 0 0
slot ptr len flg
1 24 54 0
slot 1:
0: 0 0 3 e8 61 61 20 20 20 20 20 20 20 20 20 20 ...haa
16: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
32: 20 20 20 20 c1 3 e 0 0 0 c1 1f 28 0 0 0 A.....A.(...
48: 62 62 0 0 ae e3 bb...c..........
gbasedbt[hdr2]$printf "%d\n" 0x3e8
1000
gbasedbt[hdr2]$
小结: RANGE分片表,自动扩充分片。range规则是一说,指定规则则是更高优先级的一说。
边栏推荐
- Babbitt | Metaverse daily must-read: Weibo animation will recruit all kinds of virtual idols around the world and provide support for them...
- buuctf(探险1)
- 工业元宇宙对工业带来的改变
- 基于 eBPF 的 Kubernetes 可观测实践
- 静态iP与权限更改[通俗易懂]
- Win10只读文件夹怎么删除
- A group of friends asked for help, but the needs that were not solved in a week were solved in 3 minutes?
- MMDetection 使用示例:从入门到出门
- 怎么面试程序员的?傲慢与无礼,就数他牛逼
- Alibaba Cloud International Edition uses ROS to build WordPress tutorial
猜你喜欢

Babbitt | Metaverse daily must-read: Weibo animation will recruit all kinds of virtual idols around the world and provide support for them...

斯坦福:未来的RGB LED可以贴在你的皮肤上

EasyCVR调用云端录像API接口返回错误且无录像文件生成,是什么原因?

从-99打造Sentinel高可用集群限流中间件

智能视频监控平台EasyCVR如何使用接口批量导出iframe地址?

通配符SSL证书不支持多域名吗?

Documentary on Security Reinforcement of Network Range Monitoring System (1)—SSL/TLS Encrypted Transmission of Log Data

Matlab画图1

leetcode 14. 最长公共前缀

工业元宇宙对工业带来的改变
随机推荐
July 31, 2022 Summary of the third week of summer vacation
【注册荣耀开发者】赢【荣耀70】手机
2019 Haidian District Youth Programming Challenge Activity Elementary Group Rematch Test Questions Detailed Answers
Flask框架实现注册加密功能详解【Flask企业课学习】
什么是网站监控,网站监控软件有什么用?
关于ETL的两种架构(ETL架构和ELT架构)
自己经常使用的三种调试:Pycharm、Vscode、pdb调试
LVS+Keepalived群集
Babbitt | Metaverse daily must-read: Weibo animation will recruit all kinds of virtual idols around the world and provide support for them...
clickhouse online and offline table
使用scikit-learn计算文本TF-IDF值
Go 言 Go 语,一文看懂 Go 语言文件操作
CAN光纤转换器CAN光端机解决消防火灾报警
通俗易懂-二维数组只能省略行不能省略列-人话版本
网站设计师:Nicepage 4.15 Crack By Xacker
2018读书记
八猴渲染器是什么?它能干什么?八猴软件的界面讲解
DHCP&OSPF组合实验演示(Huawei路由交换设备配置)
防火墙基础之防火墙做出口设备安全防护
Thrift IDL Sample File