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.3.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.3.5
    iconOceanBase Database
    SQL - V 4.3.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

    Optimize index performance

    Last Updated:2026-04-09 02:53:55  Updated
    share
    What is on this page
    Optimization mechanism
    Configure the optimization task execution window
    Monitor optimization tasks
    Cancel optimization tasks
    References

    folded

    share

    OceanBase Database provides an automatic performance optimization mechanism for IVF indexes, which improves search performance through cache management and regular maintenance. This topic describes how to configure and monitor performance optimization tasks.

    Notice

    This feature is available starting from OceanBase Database V4.3.5 BP3. Currently, it only supports IVF indexes.

    Optimization mechanism

    Performance optimization for IVF series indexes includes two automatic tasks:

    1. Cache warming task: The system periodically checks all IVF series indexes. If the cache for an index does not exist, the system automatically triggers cache warming to load the index data into memory. Additionally, when an IVF series index is created, the system automatically warms up the cache.
    2. Cache cleanup task: The system periodically checks the caches of all IVF series indexes. If the cache corresponds to an index that has been deleted, the system automatically cleans up the invalid cache to release memory resources. Additionally, when an IVF series index is deleted, the system automatically cleans up its cache.

    Configure the optimization task execution window

    You can customize the time window for performance optimization tasks to avoid running them during peak business hours.

    In the oceanbase database, set the execution window using the vector_index_optimize_duty_time parameter:

    ALTER SYSTEM SET vector_index_optimize_duty_time='[23:00:00, 24:00:00]';
    

    Configuration details:

    • The time format is [start time, end time].
    • The above configuration means optimization tasks are executed only between 23:00:00 and 24:00:00.
    • Optimization tasks are not triggered at other times, avoiding impact on normal business operations.

    Monitor optimization tasks

    OceanBase Database provides monitoring capabilities for optimization tasks:

    • Query the DBA_OB_VECTOR_INDEX_TASKS view to check tasks that are running or pending.
    • Query the DBA_OB_VECTOR_INDEX_TASK_HISTORY view to check historical task records.

    Examples:

    1. Check current task status

      Query the DBA_OB_VECTOR_INDEX_TASKS view to see tasks that are running or waiting to run:

      SELECT * FROM oceanbase.DBA_OB_VECTOR_INDEX_TASKS;
      

      Example output:

      +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
      | TABLE_ID | TABLET_ID           | TASK_ID | START_TIME                 | MODIFY_TIME                | TRIGGER_TYPE | STATUS   | TASK_TYPE | TASK_SCN         | RET_CODE | TRACE_ID                           |
      +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
      |   500020 | 1152921504606846990 | 2002281 | 1970-08-23 17:10:23.174127 | 1970-08-23 17:10:23.174137 | USER         | FINISHED |         2 | 1750671687770026 |        0 | YAFF00B9E4D97-00063839E6BD9BBC-0-1 |
      +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
      1 row in set
      

      Task status:

      • STATUS = 0: PREPARE – waiting to execute.
      • STATUS = 1: RUNNING – currently executing.
      • STATUS = 3: FINISHED – completed.

      Task type:

      • TASK_TYPE = 2: IVF cache warming task.
      • TASK_TYPE = 3: IVF cache cleanup task.
    2. Check historical task records

      Completed tasks (STATUS = 3) are automatically archived in the history table every 10 seconds, regardless of success. Query the DBA_OB_VECTOR_INDEX_TASKS_HISTORY view to check historical records:

      -- Query historical records for a specific task ID.
      SELECT * FROM oceanbase.DBA_OB_VECTOR_INDEX_TASKS_HISTORY WHERE TASK_ID=2002281;
      

      Example output:

      +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
      | TABLE_ID | TABLET_ID           | TASK_ID | START_TIME                 | MODIFY_TIME                | TRIGGER_TYPE | STATUS   | TASK_TYPE | TASK_SCN         | RET_CODE | TRACE_ID                           |
      +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
      |   500020 | 1152921504606846990 | 2002281 | 1970-08-23 17:10:23.174127 | 1970-08-23 17:10:23.174137 | AUTO         | FINISHED |         2 | 1750671687770026 |        0 | YAFF00B9E4D97-00063839E6BD9BBC-0-1 |
      +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
      1 row in set
      

    Cancel optimization tasks

    You can cancel a specific task with the following command:

    -- Obtain trace_id from the DBA_OB_VECTOR_INDEX_TASKS_HISTORY view.
    ALTER SYSTEM CANCEL TASK <trace_id>;
    

    Notice

    You can cancel a task only during its failure retry phase by running the ALTER SYSTEM CANCEL TASK statement. If a background task is stuck in a certain execution stage, you cannot cancel it using this statement.

    Example:

    -- Log in to the system and obtain the trace_id of the specified task
    SELECT * FROM oceanbase.DBA_OB_VECTOR_INDEX_TASK_HISTORY WHERE TASK_ID=2037736;
    +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
    | TABLE_ID | TABLET_ID           | TASK_ID | START_TIME                 | MODIFY_TIME                | TRIGGER_TYPE | STATUS   | TASK_TYPE | TASK_SCN         | RET_CODE | TRACE_ID                           |
    +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
    |   500041 | 1152921504606847008 | 2037736 | 1970-08-23 17:10:23.203821 | 1970-08-23 17:10:23.203821 | USER         | PREPARED |         2 | 1750682301145225 |       -1 | YAFF00B9E4D97-00063839E6BDDEE0-0-1 |
    +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
    1 row in set
    
    -- Cancel the task.
    ALTER SYSTEM CANCEL TASK "YAFF00B9E4D97-00063839E6BDDEE0-0-1";
    

    After the task is canceled, its status changes to CANCELLED:

    -- Log in to the user database and query the task status.
    SELECT * FROM oceanbase.DBA_OB_VECTOR_INDEX_TASK_HISTORY;
    +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
    | TABLE_ID | TABLET_ID           | TASK_ID | START_TIME                 | MODIFY_TIME                | TRIGGER_TYPE | STATUS   | TASK_TYPE | TASK_SCN         | RET_CODE | TRACE_ID                           |
    +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
    |   500041 | 1152921504606847008 | 2037736 | 1970-08-23 17:10:23.203821 | 1970-08-23 17:10:23.203821 | USER         | FINISHED |         2 | 1750682301145225 |    -4072 | YAFF00B9E4D97-00063839E6BDDEE0-0-1 |
    +----------+---------------------+---------+----------------------------+----------------------------+--------------+----------+-----------+------------------+----------+------------------------------------+
    1 row in set
    

    References

    • Maintain indexes

    Previous topic

    Maintain indexes
    Last

    Next topic

    Use SQL functions
    Next
    What is on this page
    Optimization mechanism
    Configure the optimization task execution window
    Monitor optimization tasks
    Cancel optimization tasks
    References