地图分区

地图分区 - “在表分区名称和存储组名称之间创建关联

句法

地图分区 partition_name STORE IN storage_group_name

描述

The 地图分区 command creates an association between a table partition name and a storage group name. This establishes a storage group name for subsequent partitions that do not otherwise establish a storage group name. The 地图分区 command has no effect on existing partitions. See 例2. below.

For each table created with a 创建表 statement, the STORE IN clause associated with that statement takes precedence when used in conjunction with a 地图分区 statement and STORE IN clause.

有关创建存储组的信息,请参阅 管理存储组。要从表分区名称删除映射到存储组,请参阅 联络分区.

参数

partition_name

您所在的表格分区的名称。

storage_group_name

此表分区将映射到的存储组。

例子

Example 1: Map a table partition called p1 to a previously created storage group sg1.
地图分区 P1 STORE IN SG1;
例2.: The 地图分区 command has no effect on existing partitions.
CREATE TABLE Table1 (f1 int) PARTITION BY RANGE (f1) PARTITION P1 VALUES LESS THAN (10) STORE IN SG1;
MAP PARTITION P1 STORE IN SG2;
CREATE TABLE Table2 (f1 int) PARTITION BY RANGE (f1) PARTITION P1 VALUES LESS THAN (10);
UNMAP PARTITION P1;
MAP PARTITION P1 STORE IN SG3;
CREATE TABLE Table3 (f1 int) PARTITION BY RANGE (f1) PARTITION P1 VALUES LESS THAN (10);

选择 tablename, partitionname, storagegroup FROM system.partitionids;

TABLENAME  PARTITIONNAME  STORAGEGROUP
---------- -------------- -------------

Table1           P1           SG1
Table2           P1           SG2
Table3           P1           SG3