当前位置:网站首页>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规则是一说,指定规则则是更高优先级的一说。
边栏推荐
- Thrift IDL示例文件
- Hezhou Cat1 4G module Air724UG is configured with RNDIS network card or PPP dial-up, and the development board is connected to the Internet through the RNDIS network card (taking the RV1126/1109 devel
- #yyds干货盘点# 面试必刷TOP101:链表相加(二)
- 方法的重写
- Flink / Scala - 使用 RedisSink 存储数据
- MMDetection 使用示例:从入门到出门
- 数仓相关,总结
- 从-99打造Sentinel高可用集群限流中间件
- 当项目中自动格式化插件Prettier和ESLint冲突报错时如何解决
- 开发那些事儿:如何通过EasyCVR平台获取监控现场的人流量统计数据?
猜你喜欢
合宙Cat1 4G模块Air724UG配置RNDIS网卡或PPP拨号,通过RNDIS网卡使开发板上网(以RV1126/1109开发板为例)
Flink / Scala - 使用 RedisSink 存储数据
About the two architectures of ETL (ETL architecture and ELT architecture)
网络靶场监控系统的安全加固纪实(1)—SSL/TLS对日志数据加密传输
Introduction of three temperature measurement methods for PT100 platinum thermal resistance
unity中实现ue眼球的渲染
部署LVS-DR群集
报道称任天堂在2023年3月前不会推出任何新硬件产品
Nintendo won't launch any new hardware until March 2023, report says
巴比特 | 元宇宙每日必读:微博动漫将招募全球各类虚拟偶像并为其提供扶持...
随机推荐
方法的重写
Thrift IDL示例文件
语音识别学习资源
机器学习——线性回归
Web端即时通讯技术:WebSocket、socket.io、SSE
路由技术
FE01_OneHot-Scala应用
谁能解答?从mysql的binlog读取数据到kafka,但是数据类型有Insert,updata,
Investigation and Research Based on the Involution Behavior of College Students
How to recruit programmers
"No title"
PT100铂热电阻三种测温方法介绍
部署LVS-DR群集
Thrift安装配置
Develop those things: How to obtain the traffic statistics of the monitoring site through the EasyCVR platform?
老电脑怎么重装系统win10
Interval greedy (interval merge)
巴比特 | 元宇宙每日必读:微博动漫将招募全球各类虚拟偶像并为其提供扶持...
Matlab画图1
22/8/4 记忆化搜索+博弈论