学习内容:openGauss分区表。分区表是把逻辑上的一张表根据某种方案分成几张物理块进行存储,这张逻辑上的表称之为分区表,物理块称之为分区,
分区表是一张逻辑表,不存储数据,数据实际是存储在分区上的。
课后作业:
1.创建一个含有5个分区的范围分区表store,在每个分区中插入记录
create table test_partition(id int) partition by range(id) (partition test_partition_p0 values less than (10),partition test_partition_p1 values less than (20),partition test_partition_p2 values less than (30),partition test_partition_p3 values less than (40),partition test_partition_p4 values less than (50));
insert into test_partition values (1);
insert into test_partition values (10);
insert into test_partition values (20);
insert into test_partition values (30);
insert into test_partition values (40);
2. 查看分区1上的数据
select * from test_partition partition(test_partition_p0);
3. 重命名分区2
alter table test_partition rename partition test_partition_p1 to test_partition_p11;
4.删除分区5
alter table test_partition drop partition test_partition_p4;5.增加分区6
alter table test_partition add partition test_partition_p5 values less than (60);
6.在系统表pg_partition中查看分区信息
select * from pg_partition;7.删除分区表
drop table test_partition;「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




