From the storage perspective of OceanBase Database, the top level of the storage structure is the partition group (PG). PG is often used as an abbreviation for partition group. PG is a concept abstracted to achieve extreme performance. In a user transaction, multiple different tables may be accessed. In the distributed architecture of OceanBase Database, it is difficult to ensure that these tables reside on the same server, which leads to distributed transactions. Distributed transactions rely on two-phase commit and incur greater overhead. If these tables reside on the same server, the transaction can be optimized with one-phase commit for better performance. However, in most cases, table locations cannot be guaranteed. In many Internet applications, tables are partitioned by user ID using the same partitioning rule. OceanBase Database provides syntax for building a table group. Corresponding partitions across tables in a table group are called a partition group. OceanBase Database ensures that multiple partitions in the same partition group are always bound together. In this way, transaction operations on the same partition group are optimized into single-node transactions for better performance.
A partition group may contain multiple partitions. Note that the partitioning keys and partitioning rules of these partitions must be identical. A partition group is the minimum unit for leader election and migration/replication in OceanBase Database. A partition is a partition of a table, and its definition is basically the same as in Oracle and MySQL. Tables can be partitioned in many ways, such as hash partitioning, range partitioning, list partitioning, and even subpartitioning. However, the storage layer does not distinguish between these partitioning rules and treats all partitions the same.
OceanBase Database supports creating local indexes on user tables. A local index is stored in the same partition as the primary table. The primary table and each index are stored in separate Table Stores. Each Table Store contains multiple SSTables and MemTables. MemTables reside in memory, hold dynamic data, and support read and write operations. SSTables reside on disk, hold static data, and are read-only.

