This topic describes how to merge table groups. This syntax applies to only AUTO mode databases.

Syntax

When you merge multiple source table groups with the same partition definition into a destination table group, if the partitions of the source table groups and the destination table group are located in different storage nodes, you must migrate the partitions of the source table groups on other storage nodes to the storage node on which the partitions of the destination table group are located.

The following syntax can be used to merge multiple table groups into one table group:

MERGE TABLEGROUPS sourceTg1[,sourceTgn] INTO targetTg [force]

Limits

  • This syntax cannot be used if the source table groups and the destination table group have different partition definitions.
  • Only statements with the FORCE keyword can be executed if the partitions of the source table groups and the destination table group are located in different storage nodes.
  • This syntax cannot be used if the destination table group is not manually created.
  • Two empty table groups cannot be merged.

Example

You can execute the following statement to merge the tg1 and tg2 table groups into the tg3 table group.

MERGE TABLEGROUPS tg1,tg2 INTO tg3;