当前位置: 首页 > news >正文

网站建设理由和目的河南做网站推广

网站建设理由和目的,河南做网站推广,wamp网站开发视频教程,二次开发接口一般来说,我们二级分区表都会使用模版,如果没有使用模版特性,那么就会报ERROR: no partitions specified at depth 2类似的错误。因为没有模版,必须要显式指定分区。 当然我们在建表的时候,如果没有指定,那…

一般来说,我们二级分区表都会使用模版,如果没有使用模版特性,那么就会报ERROR: no partitions specified at depth 2类似的错误。因为没有模版,必须要显式指定分区。

当然我们在建表的时候,如果没有指定,那么后面也可以通过alter table 语句进行添加。下面我们通过一个例子看一下。

CREATE TABLE sales (trans_id integer,ctime timestamp without time zone,region text
)DISTRIBUTED BY (trans_id) PARTITION BY RANGE(ctime)SUBPARTITION BY LIST(region)(START ('2023-08-18 00:00:00'::timestamp without time zone) END ('2023-08-19 00:00:00'::timestamp without time zone) WITH (tablename='sales_1_prt_1', appendonly='false')(SUBPARTITION usa VALUES('usa') WITH (tablename='sales_1_prt_1_2_prt_usa', appendonly='false'),SUBPARTITION asia VALUES('asia') WITH (tablename='sales_1_prt_1_2_prt_asia', appendonly='false'),SUBPARTITION europe VALUES('europe') WITH (tablename='sales_1_prt_1_2_prt_europe', appendonly='false')));#如果只指定一级分区,添加分区会报错
alter table sales add partition sale_3  start (date '2023-08-20') inclusive end (date '2023-08-21') exclusive ;
NOTICE:  CREATE TABLE will create partition "sales_1_prt_sale_3" for table "sales"
ERROR:  no partitions specified at depth 2
#必须显式指定才可以添加成功
alter table sales add partition sale_2 
START ('2023-08-19 00:00:00'::timestamp without time zone) END ('2023-08-20 00:00:00'::timestamp without time zone) (SUBPARTITION usa VALUES('usa'),SUBPARTITION asia VALUES('asia') ,SUBPARTITION europe VALUES('europe') );
#插入一些测试数据
insert into sales select generate_series(1,10000000) ,current_date ,'usa';
insert into sales select generate_series(1,10000000) ,current_date ,'asia';
insert into sales select generate_series(1,10000000) ,current_date ,'europe';#添加模版,就算之前有历史数据,也是瞬间完成
ALTER TABLE sales
SET SUBPARTITION TEMPLATE(SUBPARTITION usa VALUES('usa') WITH (tablename='sales'),SUBPARTITION asia VALUES('asia') WITH (tablename='sales'),SUBPARTITION europe VALUES('europe') WITH (tablename='sales'))
;
NOTICE:  adding level 1 subpartition template specification for relation "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_subpartition_template" for table "sales"NOTICE:  CREATE TABLE will create partition "sales" for table "sales_1_prt_subpartition_template"
NOTICE:  CREATE TABLE will create partition "sales" for table "sales_1_prt_subpartition_template"
NOTICE:  CREATE TABLE will create partition "sales" for table "sales_1_prt_subpartition_template"
ALTER TABLE#这次只指定一级分区就可以添加成功
alter table sales  add partition sale_3  start (date '2023-08-20') inclusive end (date '2023-08-21') exclusive ;
NOTICE:  CREATE TABLE will create partition "sales_1_prt_sale_2" for table "sales"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_sale_2_2_prt_usa" for table "sales_1_prt_sale_2"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_sale_2_2_prt_asia" for table "sales_1_prt_sale_2"
NOTICE:  CREATE TABLE will create partition "sales_1_prt_sale_2_2_prt_europe" for table "sales_1_prt_sale_2"
ALTER TABLE

总结:
建表的时候,最好添加二级分区以后的模版,模版也可以后面变更,如果不加模版,添加分区的时候,必须指定子分区,所以分区级别越多,越复杂。

http://www.yayakq.cn/news/247638/

相关文章:

  • 网站建设带有注册账号wordpress 网站关键词设置
  • 东莞系统网站建设软件开发技术
  • 济南手机网站开发公司电话html个人博客网页设计
  • 淘宝官方网站主页做pc端网站渠道
  • 免费生成网站的app广告公司寮步网站建设
  • 网站页面制作多少钱无锡企业网站建设费用
  • 建个人网站需要哪些网站做虚假广告
  • 游戏创作平台业务型网站做seo
  • dedecms网站栏目管理网站怎么设置支付
  • dede宠物网站模板互联网公司排名100强
  • dede 建设网站百度收录网站多久
  • 品牌网站建设知名大蝌蚪做酷炫网站能卖钱吗
  • 泉州设计网站厦门+外贸公司做网站
  • 可以搜索企业信息的软件网站为什么要做seo
  • 新手学习网站建设手机wap网站模板免费下载
  • 网站建设一次哈尔滨市建设工程网
  • 关于校园网站升级建设的报告河北黄页网
  • 有哪些比较好的做ppt好的网站微网站是不是就是手机网站
  • 博客网站开发思维导图网站推广塔山双喜
  • 网站后台管理代码一个成功的网站必须具备哪几个要素
  • 传扬互动网站建设公司wordpress 模仿APP插件
  • 安徽 电子政务网站定制东莞网络推广公司电话
  • 东莞网站优化哪个公司好注册开发公司
  • 哪个网站有学做吃的网架公司赵娜
  • 四川建设人才网网站网站logo更换
  • 建站平台哪个比较权威扬州网站开发公司电话
  • 长沙哪家做网站设计好霸气又聚财的公司名字大全
  • 成都市网站建设哪家好网站所有者是什么意思
  • 手机网站Com江苏网站建设效果好
  • 做公司企业网站标准尺寸网站权重优化方式