DB2 分区表

创建:
短形式:
CREATE TABLE t1(c1 INT)
  IN tbsp1, tbsp2, tbsp3
  PARTITION BY RANGE(c1)
  (STARTING FROM (0) ENDING (80) EVERY (10))
 
 
长形式:
CREATE TABLE t1(c1 INT)
  PARTITION BY RANGE(c1)
  (STARTING FROM (0) ENDING (10) IN tbsp1,
                     ENDING (20) IN tbsp2,
                     ENDING (30) IN tbsp3,
                     ENDING (40) IN tbsp1,
                     ENDING (50) IN tbsp2,
                     ENDING (60) IN tbsp3,
                     ENDING (70) IN tbsp1,
                     ENDING (80) IN tbsp2)
索引:默认存储在第一个分区中
例如:create table sales
(invoice_no        integer,
sales_date          date,
sales_amt            numeric(5,2))
in tbsp0, tbsp1, tbsp2, tbsp3
partition by range (sales_date nulls first)
(starting '1/1/2006' ending '12/31/2006' every 3 months);
 
create index sales_index on sales(invoice_no);
或者 create index sales_index on sales(invoice_no) in tbsp3;

Comments

Popular posts from this blog

Nginx Proxy & Load Balance & LNMP

Snort+barnyard2+Snorby CentOS 6.5_64 Installation

ORACLE Error