A table group is not a physical object but a logical concept. It represents a collection of tables. Tables that belong to the same group meet some conditions. To be specific, the tables must have the same locality (the replica type, quantity, and location), the same primary zone (the leader location and priority), and the same partitioning method.
By defining a table group, you can control the physical closeness among a group of tables. A table group that contains partitioned tables also consists of several partition groups. Each partition group contains one partition from each table. OceanBase Database automatically moves all the partitions in the same partition group to the same OBServer node. OceanBase Database also moves all the leaders of these partitions to the same OBServer node.
Note the following limitations on the tables in a table group:
The tables must use the same partitioning method.
The Oracle mode does not support KEY partitioning.
HASH-partitioned tables must have the same number of partitions.
The Oracle mode does not support RANGE COLUMNS or LIST COLUMNS partitioning.
RANGE-partitioned tables must have the same number of partitions and the same range definitions.
Note the following rules on the subpartitions of tables in a table group:
The Oracle mode does not support KEY partitioning.
HASH-partitioned tables must have the same number of partitions.
The Oracle mode does not support RANGE COLUMNS partitioning.
You can add or drop partitions only for 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. To be specific, the system checks whether the table to be added and the existing tables in the group have matching partitioning methods, primary zones, and localities.