XUANWU_V2 is the next-generation analytical storage engine for AnalyticDB for MySQL. It builds on the original XUANWU engine with OSS-based storage, a new columnar format, and an independent compaction service.
Prerequisites
An AnalyticDB for MySQL Enterprise Edition, Basic Edition, or Data Lakehouse Edition cluster is created.
Cluster minor version 3.2.2.0 or later
NoteTo view and update the minor version of a 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 for high-throughput writes and high-performance queries in real time. The next-generation engine, XUANWU_V2, introduces the following improvements:
OSS-based storage -- Stores all data in Object Storage Service (OSS) and uses cloud disks as a cache. This reduces storage costs, maintains query performance, and enables faster scale-out.
Next-generation column-oriented storage -- Provides finer-grained control over memory usage and disk I/O, supports highly concurrent I/O operations, and requires fewer memory resources. This improves query performance and reduces the impact of garbage collection (GC).
Independent compaction service -- Offloads resource-intensive compaction operations to a separate resource pool and process. This improves query and write stability, increases compaction throughput, and enables more flexible resource scheduling.
Limitations
Feature comparison: XUANWU vs. XUANWU_V2
XUANWU_V2 does not support all features available in the XUANWU engine.
| Feature | XUANWU | XUANWU_V2 |
|---|---|---|
| Regular index | Full-column indexes by default (INDEX_ALL='Y') | Primary key index only by default (INDEX_ALL='N'). See below for how to enable full-column indexes. |
| Vector index | Supported | Not supported |
| Binary log | Supported | Not supported |
| Spark elastic import | Supported | Not supported |
Enable full-column indexes for XUANWU_V2 tables
Use any of the following methods:
Before table creation (cluster level): Run the following statement to enable full-column indexes for all existing and new tables:
SET ADB_CONFIG XUANWUV2_DEFAULT_INDEX_ALL=trueDuring table creation: Specify
INDEX_ALL='Y'in the CREATE TABLE statement.After table creation: Run an ALTER TABLE statement to modify the index configuration.
Engine switching
You cannot switch between the XUANWU and XUANWU_V2 engines. To change the table engine, create a new table with the desired engine and migrate data from the source table.
Billing
By default, XUANWU_V2 table data is treated as hot data and billed as hot data storage. If you configure tiered storage of hot and cold data for XUANWU_V2 tables, both hot data storage and cold data storage charges apply. For details, see Pricing for Enterprise Edition and Basic Edition and Pricing for Data Lakehouse Edition.
Log on to the AnalyticDB for MySQL console and go to the Storage Overview page to view the data size of XUANWU_V2 tables.
Specify a table engine
For AnalyticDB for MySQL clusters of V3.2.2.0 or later, the default table engine is XUANWU_V2. Change the table engine at the cluster level or the table level.
Configuration parameter names use XUANWUV2 (no underscore), while the engine name is XUANWU_V2 (with underscore).
Cluster-level configuration
Run the following statement to set the default 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. Existing tables are not affected. Even if you specify
ENGINE=XUANWUwhen creating a table, the engine is automatically set to XUANWU_V2.NoteTo create a XUANWU table when this setting is
true, add the/* RC_DDL_ENGINE_REWRITE_XUANWUV2=false */hint to the CREATE TABLE statement.false: Sets the table engine to XUANWU for new tables. Existing tables are not affected. To create a XUANWU_V2 table, specify
ENGINE=XUANWU_V2or add the/* RC_DDL_ENGINE_REWRITE_XUANWUV2=true */hint to the CREATE TABLE statement.
Query the current cluster-level table engine setting:
SHOW ADB_CONFIG KEY=RC_DDL_ENGINE_REWRITE_XUANWUV2;Table-level configuration
Only AnalyticDB for MySQL clusters of V3.2.2.12 or later support table-level configuration, except for V3.2.3.1 and V3.2.3.2.
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 the current statement. Existing tables are not affected. Even if you specify
ENGINE=XUANWU, the engine is automatically set to XUANWU_V2.false: Sets the table engine to XUANWU for the table created by the current statement. Existing tables are not affected. To use XUANWU_V2, explicitly specify
ENGINE=XUANWU_V2.
Enable the disk cache feature
Enabling the disk cache feature causes the cluster to restart automatically. Transient connections may occur. Enable this feature during off-peak hours and make sure your application is configured to reconnect automatically.
Cold data in XUANWU_V2 tables is stored in OSS. The disk cache feature uses a specified cache to improve random cold data read performance. Charges are based on the specified cache size.
We recommend that you do not disable the disk cache feature to prevent serious performance degradation.
Procedure
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.
In the Configuration Information section of the Cluster Information page, click Configure next to the Cluster Query Acceleration Configuration parameter.
In the Cluster Query Acceleration Configuration dialog box, click the Disk Cache tab. Turn on the toggle and specify a cache size.
After you enable the disk cache feature, view the specified cache size by repeating the steps above.
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. The compaction service is disabled by default. After you enable it, charges are based on the pay-as-you-go billing method. You can disable the compaction service at any time. For details, see Pricing for Enterprise Edition and Basic Edition and Pricing for Data Lakehouse Edition.
Consider enabling the compaction service when:
CPU utilization and memory usage are high.
Scheduled compaction operations significantly affect service performance.
Procedure
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.
In the Configuration Information section of the Cluster Information page, click Configure next to the Cluster Query Acceleration Configuration parameter.
On the Remote Build tab of the Cluster Query Acceleration Configuration dialog box, turn on the toggle to enable the compaction service.