You can execute the CREATE TABLEGROUP statement to create a table group in a database.

Definition

A table group is a table attribute. In PolarDB-X, you can create a table group and then associate multiple tables with the table group. Tables in the same table group must use the same partitioning policy. In addition, partition changes must be synchronized to all partitioned tables in the same table group. For example, if you want to split a partition of a table in a table group, you must split the same partitions of the other tables in this table group.

Syntax

create_tablegroup_stmt:
    CREATE tablegroup [IF NOT EXISTS] tablegroup_name

Examples

Create a table group named test_tg.
create tablegroup test_tg;
After you create the table group, you can execute the show tablegroup statement to query the information about the table group. For example, execute the following statement to query the information about the test_tg table group:
show tablegroup where TABLE_GROUP_NAME='test_tg'