Create the table:
CREATE TABLE DOCUMENTS( DOC_ID INTEGER NOT NULL, LEGAL_ENTITY INTEGER NULL, CREATED_DT DATE NOT NULL, REGION VARCHAR(30) NULL, DOCUMENTTYPE VARCHAR(100) NULL, DOCUMENTNAME VARCHAR(1000) NULL ) PARTITION BY LIST (DOCUMENTTYPE);
Create a couple of partitions, including a default partition:
CREATE TABLE P_SUBPOENAS PARTITION OF DOCUMENTS FOR VALUES IN ('SUBPOENA'); CREATE TABLE P_AFFIDAVITS PARTITION OF DOCUMENTS FOR VALUES IN ('AFFIDAVIT'); CREATE TABLE P_MEMORANDOMS PARTITION OF DOCUMENTS FOR VALUES IN ('MEMORANDOM'); CREATE TABLE P_DEFAULT PARTITION OF DOCUMENTS DEFAULT;
To add a primary key to a partitioned table, read this post
If your LIST-partitioned table would benefit from sub-partitioning, read this post
No comments:
Post a Comment