MAP PARTITION

MAP PARTITION — create an association between a table partition name and a storage group name

Syntax

MAP PARTITION partition_name STORE IN storage_group_name

Description

The MAP PARTITION 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 MAP PARTITION command has no effect on existing partitions. See Example 2 below.

For each table created with a CREATE TABLE statement, the STORE IN clause associated with that statement takes precedence when used in conjunction with a MAP PARTITION statement and STORE IN clause.

For information on create storage groups see Managing Storage Groups. To remove the mapping from a table partition name to a storage group, see UNMAP PARTITION.

Parameters

partition_name

The name you are giving to this table partition.

storage_group_name

The storage group to which this table partition will map.

Examples

Example 1: Map a table partition called p1 to a previously created storage group sg1.
MAP PARTITION P1 STORE IN SG1;
Example 2: The MAP PARTITION 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);

SELECT tablename, partitionname, storagegroup FROM system.partitionids;

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

Table1           P1           SG1
Table2           P1           SG2
Table3           P1           SG3