论断:分区表创立分区时,范畴定义是左闭右开。

创立分区表

create table orders(    id          bigint,    create_time timestamp(0) default current_timestamp) partition by range (id);

创立默认分区

当插入数据没有子分区匹配时,会增加到默认分区。

create table def partition of orders default;

创立子分区

create table orders_1 partition of orders for values from (1) to (10);create table orders_2 partition of orders for values from (10) to (20);

插入数据

测试1:

insert into orders(id) values (10);

记录在 orders_2 子分区中。

测试2:

insert into orders(id) values (20);

记录在 def 默认分区中。