All Products
Search
Document Center

AnalyticDB:XUANWU_V2 engine

Last Updated:Jun 03, 2025

This topic describes how to use the XUANWU_V2 engine and the compaction service in AnalyticDB for MySQL.

Prerequisites

  • An AnalyticDB for MySQL Enterprise Edition, Basic Edition, or Data Lakehouse Edition cluster is created.

  • The minor version of the cluster is 3.2.2.0 or later.

    Note

    To view and update the minor version of an AnalyticDB for MySQL cluster, log on to the AnalyticDB for MySQL console and go to the Configuration Information section of the Cluster Information page.

Overview

AnalyticDB for MySQL uses the XUANWU analytical storage engine to perform high-throughput writes and high-performance queries in real time. The next-generation storage engine, XUANWU_V2, provides the following features:

  • Stores all data in Object Storage Service (OSS) and uses cloud disks as a cache. This reduces storage costs, ensures query performance, and provides faster scale-out capabilities and higher scaling efficiency.

  • Provides the next-generation column-oriented storage. The new storage format provides finer-grained control over memory usage and disk I/O, supports highly concurrent I/O operations, and uses fewer memory resources. This improves query performance and reduces impact of garbage collection (GC) on your business.

  • Uses the independent compaction service to perform the compaction operations that consume a large amount of resources. This improves query and write stability and provides higher compaction throughput and more flexible resource scheduling capabilities.

Limits

  • The XUANWU_V2 engine does not fully support all the features available in the XUANWU engine. The following table describes the comparison results between the two engines.

    Comparison item

    XUANWU

    XUANWU_V2

    Regular index

    By default, full-column indexes are created by using INDEX_ALL='Y'.

    By default, indexes are created only for the primary key by using INDEX_ALL='N'.

    Note

    Methods to create and modify full-column indexes:

    • Before you create a table, execute the SET ADB_CONFIG XUANWUV2_DEFAULT_INDEX_ALL=true statement at the cluster level to create full-column indexes for the existing and new tables.

    • When you create a table, specify INDEX_ALL='Y' in the CREATE TABLE statement to create full-column indexes for the existing tables.

    • After you create a table, execute the ALTER TABLE statement to modify full-column indexes for the existing tables.

    Vector index

    Supported

    Not supported

    Binary log

    Supported

    Not supported

    Spark elastic import

    Supported

    Not supported

  • The XUANWU and XUANWU_V2 engines cannot be switched between each other. If you want to change the table engine of a table, you must create a new table and migrate data from the source table to the new table.

    For example, the table engine of the test table is XUANWU_V2 and cannot be changed to XUANWU. You can create a table whose table engine is XUANWU and migrate data from the test table to the new table.

Billing rules

By default, the data of XUANWU_V2 tables is considered hot data and is billed based on hot data storage. If you specify tiered storage of hot and cold data for XUANWU_V2 tables, the data of XUANWU_V2 tables is billed based on hot data storage and cold data storage. For more information, see Pricing for Enterprise Edition and Basic Edition and Pricing for Data Lakehouse Edition.

Note

You can log on to the AnalyticDB for MySQL console and go to the Storage Overview page to view the data size of tables whose table engine is XUANWU_V2.

Specify a table engine

For AnalyticDB for MySQL clusters of V3.2.2.0 or later, the default table engine is XUANWU_V2. You can change the table engine at the cluster or table level.

Cluster-level configuration

Execute the following statement to specify a table engine at the cluster level:

SET ADB_CONFIG RC_DDL_ENGINE_REWRITE_XUANWUV2=false|true;

Valid values:

  • true (default): sets the table engine to XUANWU_V2 for new tables while retaining the table engines of existing tables unchanged. Even if you specify ENGINE=XUANWU when you create a table, the table engine of the table is automatically changed to XUANWU_V2.

    Note

    If you want to create a table whose table engine is XUANWU, you can add the /* RC_DDL_ENGINE_REWRITE_XUANWUV2=false */ hint to the CREATE TABLE statement.

  • false: sets the table engine to XUANWU for new tables while retaining the table engines of existing tables unchanged. If you want to create a table whose table engine is XUANWU_V2, you can specify ENGINE=XUANWU_V2 or add the /* RC_DDL_ENGINE_REWRITE_XUANWUV2=true */ hint to the CREATE TABLE statement.

Execute the following statement to query the table engine at the cluster level:

SHOW ADB_CONFIG KEY=RC_DDL_ENGINE_REWRITE_XUANWUV2;

Table-level configuration

Important

Only AnalyticDB for MySQL clusters of V3.2.2.12 or later, except for V3.2.3.1 and V3.2.3.2, support the table-level configuration.

The table-level configuration applies only to the current CREATE TABLE statement and takes precedence over the cluster-level configuration.

/* RC_DDL_ENGINE_REWRITE_XUANWUV2=false|true */

Valid values:

  • true (default): sets the table engine to XUANWU_V2 for the table created by executing the current SQL statement while retaining the table engines of existing tables unchanged. Even if you specify ENGINE=XUANWU when you create a table, the table engine of the table is automatically changed to XUANWU_V2.

  • false: sets the table engine to XUANWU for the table created by executing the current SQL statement while retaining the table engines of existing tables unchanged. If you want to create a table whose table engine is XUANWU_V2, you must specify ENGINE=XUANWU_V2.

Enable the disk cache feature

Warning

After you enable the disk cache feature, the cluster automatically restarts. In this case, transient connections may occur. We recommend that you enable the disk cache feature during off-peak hours and make sure that your application is configured to automatically reconnect to the cluster.

The cold data of XUANWU_V2 tables is stored in OSS. After you enable the disk cache feature, you can use the specified cache to improve the random cold data read performance of XUANWU_V2 tables. You are charged based on the specified cache size.

We recommend that you do not disable the disk cache feature to prevent serious performance degradation.

  1. Log on to the AnalyticDB for MySQL console. In the upper-left corner of the console, select a region. In the left-side navigation pane, click Clusters. Find the cluster that you want to manage and click the cluster ID.

  2. In the Configuration Information section of the Cluster Information page, click Configure next to the Cluster Query Acceleration Configuration parameter.

  3. In the Cluster Query Acceleration Configuration dialog box, click the Disk Cache tab. Turn on image and specify a cache size.

Note

After you enable the disk cache feature, you can view the specified cache size by performing the preceding steps.

Enable the compaction service

The compaction service uses an independent resource pool to perform local compaction operations in an independent process. This reduces resource usage and improves service stability. By default, the compaction service is disabled. After you enable the compaction service, you are charged for the compaction service based on the pay-as-you-go billing method. You can disable the compaction service based on your business requirements. For more information, see Pricing for Enterprise Edition and Basic Edition and Pricing for Data Lakehouse Edition.

We recommend that you enable the compaction service in scenarios that meet the following conditions:

  • The CPU utilization and the memory usage are high.

  • The service performance is significantly affected by scheduled compaction operations.

Procedure

  1. Log on to the AnalyticDB for MySQL console. In the upper-left corner of the console, select a region. In the left-side navigation pane, click Clusters. Find the cluster that you want to manage and click the cluster ID.

  2. In the Configuration Information section of the Cluster Information page, click Configure next to the Cluster Query Acceleration Configuration parameter.

  3. On the Remote Build tab of the Cluster Query Acceleration Configuration dialog box, turn on image to enable the compaction service.

OSZAR »