A table group is not a physical object. It is a logical concept that represents a collection of tables. Tables that belong to the same group must meet some conditions. All the tables in a table group must have the same locality, which includes the type, number, and location of replicas, the same primary zone (including the location of the leader and the priority of the zone), and the same partitioning method.
By defining a table group, you can control the physical closeness between a group of tables. A table group that contains partitioned tables also consists of several partition groups. Each partition group includes one partition from each table. OceanBase automatically moves all the partitions in the same partition group to the same OBserver. It also moves all the leader replica of these partitions to the same OBServer.
The tables in a table group must meet the following conditions:
The tables must use the same partitioning method.
KEY-partitioned tables must have the same number of partitions and referenced columns. The column names do not have to be identical.
HASH-partitioned tables must have the same number of partitions.
RANGE COLUMNS-partitioned tables must have the same number of partitions, the same number of referenced columns, and the same range definitions.
RANGE-partitioned tables must have the same number of partitions and the same range definitions.
Subpartitions in a table group must meet the following conditions:
KEY-partitioned tables must have the same number of partitions and referenced columns. The column names do not have to be identical.
HASH-partitioned tables must have the same number of partitions.
RANGE COLUMNS-partitioned tables must have the same number of partitions, the same number of referenced columns, and the same range definitions.
You can only add or delete partitions in a table group that consists of RANGE-partitioned tables.
You cannot use the
ALTER TABLE SET table grouporALTER TABLE GROUP add tablestatement to move a table to a table group that was created in a version earlier than OceanBase Database V2.X.X.Checks are always performed when you add a table to a table group that was created in a version later than OceanBase Database V2.X.X. This includes checking whether the tables have matching partitioning methods, primary zones, and localities.