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.4.2

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive 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.4.2
    iconOceanBase Database
    SQL - V 4.4.2
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    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

    ALTER MATERIALIZED VIEW LOG

    Last Updated:2026-04-02 06:23:57  Updated
    Share
    What is on this page
    Purpose
    Privilege requirements
    Syntax
    Parameters
    alter_mlog_action
    References

    folded

    Share

    Purpose

    This statement is used to modify the properties of a materialized view log (mlog).

    Privilege requirements

    To execute the ALTER MATERIALIZED VIEW LOG statement, the current user must have the ALTER privilege on the base table. For more information about OceanBase Database privileges, see Privilege types in MySQL-compatible mode.

    Syntax

    ALTER MATERIALIZED VIEW LOG ON [database.]table_name alter_mlog_action_list;
    
    alter_mview_action_list:
        alter_mlog_action [, alter_mlog_action ...]
    
    alter_mlog_action:
        parallel_clause
        | PURGE [[START WITH expr] [NEXT expr]]
        | LOB_INROW_THRESHOLD [=] integer
    
    parallel_clause:
        NOPARALLEL
        | PARALLEL integer
    

    Parameters

    Parameter
    Description
    database. Optional. Specifies the database where the materialized view is located. If you omit database., the base table is assumed to be in the database to which the current session is connected.
    table_name Specifies the name of the base table corresponding to the materialized view log.
    alter_mlog_action_list A list of operations that can be performed on the materialized view log. Multiple operations can be specified, separated by commas (,). For more information, see alter_mlog_action below.

    alter_mlog_action

    • parallel_clause: Modifies the parallelism of the materialized view log table. Valid values:

      • NOPARALLEL: Parallelism is 1, which is the default setting.
      • PARALLEL integer: Specifies the parallelism. integer can be an integer greater than or equal to 1.

      Here is an example:

      -- First, create a base table.
      obclient> CREATE TABLE mvlog (
          id INT PRIMARY KEY,
          name VARCHAR(50)
      );
      
      -- Create a materialized view log.
      obclient> CREATE MATERIALIZED VIEW LOG ON mvlog;
      
      -- Set the parallelism to 5.
      obclient> ALTER MATERIALIZED VIEW LOG ON mvlog PARALLEL 5;
      
      -- Set the parallelism to 1 (default).
      obclient> ALTER MATERIALIZED VIEW LOG ON mvlog NOPARALLEL;
      
    • PURGE [[START WITH expr] [NEXT expr]]: Modifies the time interval for the background cleanup task of the materialized view log.

      • [START WITH expr]: Optional. Specifies the initial cleanup time for the materialized view log.
      • [NEXT expr]: Optional. Specifies the next cleanup time for the materialized view log.

      Notice

      Make sure that the time expressions START WITH expr and NEXT expr are set to future time points. Otherwise, an error will occur.

      We recommend that you use sysdate() to represent the current time in the current time zone. Here are some examples of time expressions:

      START WITH sysdate() NEXT sysdate() + INTERVAL 1 DAY
      

      The preceding clause indicates that the system will clear expired materialized view log records starting from the current time (sysdate()) and every 1 day.

      Here is an example:

      obclient> ALTER MATERIALIZED VIEW LOG ON mvlog PURGE START WITH sysdate();
      
      obclient> ALTER MATERIALIZED VIEW LOG ON mvlog PURGE NEXT sysdate() + INTERVAL 1 DAY;
      
      obclient> ALTER MATERIALIZED VIEW LOG ON mvlog PURGE START WITH sysdate() NEXT sysdate() + INTERVAL 1 DAY;
      
    • LOB_INROW_THRESHOLD [=] integer: Modifies the inline storage length threshold for LOBs in the materialized view log. This parameter can only be increased.

      Note

      The default value of LOB_INROW_THRESHOLD is 8 KB. The default value of LOB_INROW_THRESHOLD for mlogs is not controlled by the system variable ob_default_lob_inrow_threshold.

      Here is an example:

      obclient> ALTER MATERIALIZED VIEW LOG ON mvlog LOB_INROW_THRESHOLD 10000;
      

    References

    Materialized view logs

    Previous topic

    ALTER MATERIALIZED VIEW
    Last

    Next topic

    ALTER EXTERNAL TABLE
    Next
    What is on this page
    Purpose
    Privilege requirements
    Syntax
    Parameters
    alter_mlog_action
    References