Use the CREATE TABLEGROUP statement to create a table group in an AUTO mode database in PolarDB for Xscale.
What is a table group
A table group is an attribute you assign to tables so that multiple tables share the same partitioning policy.
The following rules apply to tables in a table group:
All tables must use the same partitioning policy.
Any partition change is synchronized across all tables in the group. For example, splitting a partition on one table requires splitting the same partition on every other table in the group.
CREATE TABLEGROUP applies to AUTO mode databases only. It is not supported in DRDS mode databases.Syntax
CREATE TABLEGROUP [IF NOT EXISTS] tablegroup_name| Element | Required | Description |
|---|---|---|
IF NOT EXISTS | No | Skips statement execution without returning an error if a table group with the same name already exists. |
tablegroup_name | Yes | The name of the table group to create. |
Example
Create a table group named test_tg:
CREATE TABLEGROUP test_tg;After creating the table group, verify it exists by running SHOW TABLEGROUP:
SHOW TABLEGROUP WHERE TABLE_GROUP_NAME = 'test_tg';该文章对您有帮助吗?