Table
Table is the most basic database object. In OceanBase Database, all tables are relational tables.
Each table consists of several rows of records, and each row has the same pre-defined columns. You can use SQL statements to create, retrieve, update, and delete (CRUD) data in a table. Generally, several columns of a table make up a primary key, which is unique among the datasets of the table.
Partition
Partition is the design technology of physical databases, which performs operations on tables. A table that is partitioned is called a partition table.
A table can be distributed across multiple partitions. You can create several horizontal partitions for a large table, and each partition contains several rows of records of the table. Based on the mapping relationship between row data and partition, partitions can be divided into Hash partitions, range partitions, and key partitions. Each partition can be divided into several partitions from different dimensions, which are called secondary partitions. For example, you can create multiple Hash partitions for a transaction table based on the user ID. You can further divide each Hash partition into multiple secondary range partitions based on the transaction time.
Table group
A table group is a group of tables. Each table belongs to one or more table groups.
Table group is a logical concept that is not associated with physical data files. It only affects the scheduling method of table partitions. OceanBase Database preferentially schedules partitions with the same partition number in the same table group to the same node, which reduces cross-node distributed transactions.
A table group is not a physical object, but a logical concept that represents a group or a set of tables. Tables that belong to such a group must meet some constraints. All tables must have the same locality (including replica type, number, and location), primary zone(leader location and priority), and the same partitioning method.
Partition group
By defining the table group, you can control the location relationship of a group of tables in physical storage media. A table group that contains partition tables consists of several partition groups. The group of partitions with the same subscript in a partition table of a table group is called a partition group. OceanBase automatically distributes the partitions of one partition group to the same OBServer. The leader of these partition replicas is located on another OBServer.
In addition to defining the "location" relationship, the partition table can serve as the "sharding". During scheduling, OceanBase also distributes different partition groups of the same table group to multiple available servers as much as possible. By doing so, OceanBase supports horizontal automatic scaling. At the same time, Partition Group is the minimum execution unit for load balancing and leader switching operations.
For different partition groups of the same table group, the table group concept cannot define or describe the location relationship between partition groups. In other words, you cannot determine whether multiple partitions of a partition table are grouped or not. Instead, RootService will keep them away as far as possible.