すべてのプロダクト
Search
ドキュメントセンター

PolarDB:KEY-* compositeパーティション

最終更新日:May 27, 2024

KEY-HASHレベル2パーティションの作成

テンプレート構文

テーブルの作成tb_k_h_tp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
ハッシュによるサブパーティー (id)
分割4

非テンプレート構文

テーブルの作成tb_k_h_ntp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
ハッシュによるサブパーティー (id)
(
  パートp1サブパート2、
  パートp2サブパート4
) 

KEY-KEYレベル2パーティションの作成

テンプレート構文

テーブルの作成tb_k_k_tp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
SUBPARTITION BY KEY(id)
分割4 

非テンプレート構文

テーブルの作成tb_k_k_ntp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
SUBPARTITION BY KEY(id)
(
  パートp1サブパート2、
  パートp2サブパート4
) 

KEY-RANGEレベル2パーティションの作成

テンプレート構文

テーブルの作成tb_k_r_tp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
範囲によるSUBPARTITION (id) (
  SUBPARTITION sp1の値は (1000) 未満、
  SUBPARTITION sp2値がより少ない (最大値)
) 

非テンプレート構文

CREATE TABLE tb_k_r_ntp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
範囲によるサブパート (id)
(
  パートp1 (
  	SUBPARTITION sp1の値は (1000) 未満、
  	SUBPARTITION sp2値がより少ない (最大値)
),
  PARTITION p2 (
  	下位分類sp3の値は (1000) 未満、
  	下位分類sp4の値は (2000) 未満、
  	SUBPARTITION sp5値がより少ない (最大値)
  )
)

KEY-RANGE COLUMNSレベル2パーティションの作成

テンプレート構文

CREATE TABLE tb_k_rc_tp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
RANGE COLUMNSによるSUBPARTITION (birthday,id)
  SUBPARTITION sp1値はより少ない ('2000-01-01 '、1000) 、
  SUBPARTITION sp2値未満 (MAXVALUE、MAXVALUE)
) 

非テンプレート構文

CREATE TABLE tb_k_rc_ntp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
RANGE COLUMNSによるSUBPARTITION (誕生日、id)
(
  パートp1 (
  	SUBPARTITION sp1値はより少ない ('2000-01-01 '、1000) 、
  	SUBPARTITION sp2値未満 (MAXVALUE、MAXVALUE)
),
  PARTITION p2 (
  	SUBPARTITION sp3はより少ない値 ('2000-01-01 '、1000) 、
    サブパートsp4値より少ない ('2020-01-01 '、2000) 、
  	SUBPARTITION sp5値未満 (MAXVALUE、MAXVALUE)
)
) 

KEY-LISTレベル2パーティションの作成

テンプレート構文

非テンプレート構文

CREATE TABLE tb_k_l_ntp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
リストによるSUBPARTITION (id)
(
  パートp1 (
  	下位分類sp1値 (1000,2000) 、
  	下位分類sp2値 (3000,4000) 、
  	SUBPARTITION sp3 VALUES In (デフォルト)
),
  PARTITION p2 (
  	下位分類sp4値 (5000,6000) 、
  	SUBPARTITION sp5 VALUES In (デフォルト)
)
) 

KEY-LIST COLUMNSレベル2パーティションの作成

テンプレート構文

CREATE TABLE tb_k_lc_tp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
リストコラムによるサブパーティー (誕生日、id)
(
  	SUBPARTITION sp1 VALUES IN (('2000-01-01 ',1000),('2000-02-01',2000)),
  	SUBPARTITION sp2 VALUES IN (('2001-01-01 ',3000),('2001-02-01',4000)),
  	SUBPARTITION sp3 VALUES In (デフォルト)
) 

非テンプレート構文

CREATE TABLE tb_k_lc_ntp (
 id bigint not null auto_increment, 
 bid int, 
 名前varchar(30) 、
 birthday datetime not null,
 主キー (id)
)
キーによるパーティー (入札、名前)
パーティー2
リストコラムによるサブパーティー (誕生日、id)
(
  パートp1 (
  	SUBPARTITION sp1 VALUES IN (('2000-01-01 ',1000),('2000-02-01',2000)),
  	SUBPARTITION sp2 VALUES IN (('2001-01-01 ',3000),('2001-02-01',4000)),
  	SUBPARTITION sp3 VALUES In (デフォルト)
),
  PARTITION p2 (
  	サブパートsp4値 (('2002-01-10 '、5000) 、('2002-02-10' 、6000)) 、
  	SUBPARTITION sp5 VALUES In (デフォルト)
)
)