OceanBase Database stores data in macroblocks. Each table can contain multiple macroblocks, and each macroblock occupies 2 MB of space. A macroblock contains one or more microblocks, and each microblock stores one or more rows.
Table organization
OceanBase Database supports two table organization methods: index-organized tables (IOT) and heap-organized tables (HOT).
Note
In OceanBase Database V4.3.5, heap-organized tables are supported starting from V4.3.5 BP1.
Index-organized tables
In an index-organized table, data is stored and sorted based on the primary key. When a row of data is inserted into the table, it is placed in the table according to the order of its primary key. In this structure, data and index are unified, with the primary key serving as the clustered index. The primary key does not incur additional space overhead, and data access is more efficient.
The columns of each row are stored in the same order. OceanBase Database generally stores data according to the column order specified during table creation, with newly added columns stored at the end.
Heap-organized tables
In a heap-organized table, data is not stored in order based on the primary key. When a row of data is inserted into the table, the order of the data is random. In this structure, the primary key index is essentially a secondary unique index, also known as a non-clustered index. Data and index are decoupled, and data can be written without considering the order, which improves data write performance.
Data in a heap-organized table is unordered. Although the index ensures that key values are kept in order, the data itself does not follow any specific order.
Row storage
Row storage organizes data in microblocks, where all columns of a row are typically stored together. When a table contains large object types (LOBs) that exceed the size of a macroblock, these large objects will overflow and be stored in separate macroblocks.
Columnar storage
Column storage is a database storage method that organizes data by columns. In columnar storage mode, the data of each column is stored as an independent SSTable, and the SSTables of all columns are combined into a virtual SSTable, serving as the baseline columnar data for users. This approach can effectively improve query performance and reduce storage space consumption.
Null value storage
OceanBase Database stores null values and uses one byte as a marker to indicate whether the value in a column is null.