This topic describes the table groups in OceanBase Database in MySQL mode.
Definition
A table group is a collection of tables. It is a logical concept. All tables in a table group must have the same locality, primary zone, and partitioning method. The locality specifies the types, number, and locations of replicas. The primary zone specifies the location of the leader and zone priorities. All tables in a table group have the same number of partitions.
A table group is an attribute of a table that affects the distribution of partitions of multiple tables on OceanBase servers.
Different partitions in a table can be distributed on different nodes. When you join two tables to run a query, OceanBase requests data across nodes. The execution time depends on the request latency between the nodes. To optimize SQL queries, we recommend that you place tables that are closely related in business into the same table group.
When you create a table group, you must first plan the use of the table group. For non-partitioned tables, you do not need to partition the table group. For partitioned tables, you must specify the partitioning strategy for the table group, and the partitioning strategy must be the same as that of the partitioned tables.
Benefits
If two or more tables have the same partitioning method, the same number of partitioning keys, and the same number of partitions, you can logically include these tables into one table group to determine the dynamic load balancing policies.
For all tables in a table group, the partitions with the same partitioning key value belong to the same partition group. The leaders of all partitions in the same partition group are scheduled to the same OBServer. This lowers the cross-server access cost caused by distributed transactions without affecting global load balancing.
The modification of the primary zone and locality for a table group applies to all tables in the table group.
You can dynamically create and drop table groups without affecting upper-layer applications.
No table group is required if a tenant has only one resource unit and one primary zone.