时间分区可以按照年月日时分秒进行分区,一般按照日或月分区就足够了,这里按照的是日分区
demo如下
create table APDEMO ( OID NUMBER(38) generated as identity (start with 1 increment by 1),--主键,自增列 REPORTTIME DATE , AP_MAC VARCHAR2(64 CHAR) , APALIASNAME VARCHAR2(128 CHAR) not null, HOTSPOTNAME VARCHAR2(128 CHAR) not null, LONGITUDE VARCHAR2(64 CHAR) , CITY VARCHAR2(50 CHAR) not null, constraint pk_APDEMO_OID primary key (OID) ) partition by range(REPORTTIME) interval (numtodsinterval(1,‘day‘)) ( partition part_20170101 values less than (to_date(‘20170101‘,‘yyyyMMdd‘)) --这里需要加入一个起始日期 );
分区貌似不能在已有表上创建,只能新建表后将原表数据导入进来
时间: 2024-11-03 21:27:55