OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.2.5

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.2.5
    iconOceanBase Database
    SQL - V 4.2.5
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Minor compaction and major compaction

    Last Updated:2026-04-09 09:38:52  Updated
    share
    What is on this page
    Data inconsistencies during a major compaction

    folded

    share

    The storage engine of OceanBase Database is built on the log-structured merge-tree (LSM-tree) architecture. In this architecture, data is stored in MemTables and SSTables. When the size of a MemTable exceeds the specified threshold, data in the MemTable is flushed to an SSTable to release the memory space. This process is called a minor compaction. Each minor compaction generates a new SSTable. When the number of minor compactions exceeds the specified threshold or during off-peak hours of a day, the baseline SSTables and the incremental SSTables generated by minor compactions are merged into one SSTable. This process is called a major compaction.

    The percentage of memory allowed for MemTables to the total available MemStore memory of a tenant is specified by the memstore_limit_percentage parameter. MemTables are classified into active MemTables and frozen MemTables. When the memory usage of MemTable reaches memstore_limit_percentage × freeze_trigger_percentage, a freeze is automatically triggered to generate a new active MemTable. The existing active MemTable becomes a frozen MemTable. Then, a minor compaction is automatically scheduled. When the minor compaction is completed, the memory occupied by the frozen MemTable is released.

    Note

    • The memstore_limit_percentage parameter specifies the percentage of memory allowed for MemTables to the total available MemStore memory of a tenant. The default value is 0. The value range is [0, 100). For more information about the parameter, see memstore_limit_percentage.
    • The freeze_trigger_percentage parameter specifies the threshold of memory usage in percentage of tenants for triggering a global freeze. The default value is 20. The value range is (0, 100). For more information about the parameter, see freeze_trigger_percentage.

    You can increase the frequency of minor compaction by using the following methods:

    • Set the freeze_trigger_percentage parameter to a smaller value.

    • Execute the alter system minor freeze statement to trigger a minor compaction.

    A major compaction is automatically triggered when the number of minor compactions in a tenant reaches the threshold specified by using the major_compact_trigger parameter. In OceanBase Database V4.0, the default value is 0, which indicates that the automatic triggering of a major compaction based on the number of minor compactions is disabled.

    Note

    The major_compact_trigger parameter specifies the threshold of the number of minor compactions at which a major compaction is triggered. The value range is [0, 65535].

    You can increase the frequency of major compaction by using the following methods:

    • Set the major_compact_trigger parameter to a smaller value.

    • Execute the alter system major freeze statement to trigger a major compaction.

    Data inconsistencies during a major compaction

    The following data inconsistencies may occur during a major compaction:

    • The number of rows in the primary table is inconsistent with that in the index table.

    • The checksum values of some columns in the major SSTable are inconsistent.

    • The checksum values of all rows in the major SSTable are inconsistent.

    Previous topic

    Bootstrap
    Last

    Next topic

    Memory-related errors
    Next
    What is on this page
    Data inconsistencies during a major compaction