A partition group belongs to the top layer in the storage structure of OceanBase Database. Partition groups refer to a concept that is abstracted to help enhance performance. A transaction can be used to manage multiple tables. In the distributed architecture of OceanBase Database, these tables are often stored on different servers, which results in distributed transactions. Distributed transactions rely on two-phase commits, which increases overheads. If these tables are stored on a single server, the transaction can be optimized in one phase to achieve higher performance. However, in most cases, you cannot determine table locations. In many Internet applications, tables are partitioned by user ID based on the same partitioning rule. OceanBase Database provides a syntax for you to group tables into a table group. Partitions within the table group constitute a partition group. OceanBase Database ensures that multiple partitions in a partition group are bound to each other. This way, operations on a partition group are optimized into a standalone transaction to achieve higher performance.
A partition group may contain multiple partitions. The partitioning key and partitioning rule must be the same. A partition group is the minimum unit for leader election and data migration/replication in OceanBase Database. The concept of partition is similar to that in Oracle and MySQL databases. There are different types of table partitions, such as hash partitions, range partitions, list partitions, and subpartitions. However, all partitions are treated the same way at the storage layer.
OceanBase Database allows you to create local indexes for user tables. The local indexes and primary table are bound and stored in the same partition, with the primary table and each index respectively stored in their separate table stores. Each table store contains multiple SSTables and MemTables. MemTables are stored in the memory. MemTables record dynamic data and can be read and written. SSTables are stored on disks. SSTables record static data and are read-only.
