Configuring Cold Tables
Scenarios
This section describes how to configure a cold table for a TaurusDB instance, including enabling cold and hot data separation, creating a cold table, and (optional) migrating back a cold table.
After migrating back a cold table, you can view its statistics, including the cold table name, validity period, and retention period. If the retention period is longer than or equal to the validity period, you can delete the cold data remaining in OBS after migration.
You can configure a cold table in either of the following ways:
- On the console: You can enable cold and hot data separation, and create and migrate back a cold table on the console.
- Using SQL statements: You can enable cold and hot data separation, and create, query, and migrate back a cold table using SQL statements. If there are more than 100,000 tables in your DB instance, you can create and migrate back a cold table only using SQL statements.
Creating and Migrating Back a Cold Table
- Log in to the TaurusDB console.
- Click
in the upper left corner and select a region. - On the Instances page, click the instance name.
- In the navigation pane, click Cold and Hot Data Separation.
- Click
on the right of Cold and Hot Data Separation. In the displayed dialog box, click OK. Figure 1 Enabling cold and hot data separation
- On the Cold Tables tab, click Create Cold Table. Figure 2 Creating a cold table
- In the search bar of the Create Cold Table dialog box, enter the name of the database, table, or partition that contains the data to be archived as cold data. You can search by database name, database name + table name, or database name + table name + partition name.
- Select the tables or partitions whose data you want to archive as cold data. As prompted, enter YES and click OK. Figure 3 Selecting tables for archiving
- After the cold table creation task is submitted, you can view it in the Unsubmitted Tasks list. The database automatically dispatches one task every 5 minutes to archive data. Figure 4 Unsubmitted tasks
You can also cancel unsubmitted tasks in the list. To cancel an individual task, click Cancel in the Operation column. To cancel multiple tasks, select them and click Batch Cancel.
- After a task is dispatched, you can view it in the Submitted Tasks list. Figure 5 Viewing submitted tasks
- If you need to frequently modify or query a table, you can migrate a single cold table or multiple cold tables back to the instance. Migrating back cold tables takes a relatively long time, so you are advised to perform this operation during off-peak hours.
- Migrate back a single cold table: In the cold table list, click Migrate Back. After confirming that the task details are correct, click OK to migrate the cold table back to the instance. Figure 6 Migrating back a single cold table
- Migrate back cold tables in batches: Select one or more cold tables and click Batch Recall. After confirming that the task details are correct, click OK to migrate the selected cold tables back to the instance. Figure 7 Migrating back cold tables in batches
- Migrate back a single cold table: In the cold table list, click Migrate Back. After confirming that the task details are correct, click OK to migrate the cold table back to the instance.
- Check that the storage space has been released (monitoring data may be delayed).

When configuring a cold table using SQL statements, you need to use DAS or a client (such as the mysql client) to connect to your TaurusDB instance and then run the corresponding SQL statements. The following procedure uses DAS as an example.
- Log in to the TaurusDB console.
- Click
in the upper left corner and select a region. - On the Instances page, click the instance name.
- In the navigation pane, click Cold and Hot Data Separation.
- Click
on the right of Cold and Hot Data Separation. In the displayed dialog box, click OK. Figure 8 Enabling cold and hot data separation
- On the Basic Information page, click Log In in the upper right corner.
Alternatively, return to the Instances page, locate the instance, and click Log In in the Operation column.
Figure 9 Logging in to an instance
- On the displayed page, enter the username and password and click Test Connection. After the connection is successful, click Log In. Figure 10 Login page
- Choose SQL Operations > SQL Window. Figure 11 SQL Operations
- Configure a cold table using SQL statements.
- Creating a cold table
CALL dbms_schs.make_io_transfer("start", "database_name", "table_name", "partition_name", "", "obs");Example:
CALL dbms_schs.make_io_transfer("start", "test", "table1", "", "", "obs");Figure 12 Creating a cold table
- Creating a cold table
- Query the archiving or migration status.
CALL dbms_schs.show_io_transfer("database_name", "table_name", "partition_name");Example:
CALL dbms_schs.show_io_transfer("test", "table1", "");Figure 13 Querying the archiving or migration status
- (Optional) Query all cold tables on an instance as user root.
The stored procedure sys.schs_show_all requires that the kernel version of your TaurusDB instance be 2.0.60.241200 or later. If the version is older, upgrade it first. For details about how to check the kernel version, see How Can I Check the Version of a TaurusDB Instance?
CALL sys.schs_show_all( "database_name", "table_name", "partition_name");
Examples:
- Querying all cold tables on an instance
CALL sys.schs_show_all( "", "", "");
- Querying all cold partitions or cold tables whose database name is test
CALL sys.schs_show_all( "test", "", "");
- Querying cold partitions or cold tables whose database name is test and table name is table1
CALL sys.schs_show_all( "test", "table1", "");
- Querying all cold tables on an instance
- Migrate back a cold table.
CALL dbms_schs.make_io_transfer("start", "database_name", "table_name", "partition_name", "obs", "");Example:
CALL dbms_schs.make_io_transfer("start", "test", "table1", "", "obs", "");Figure 14 Migrating back a cold table
Collecting Cold Table Statistics
- Log in to the TaurusDB console.
- Click
in the upper left corner and select a region. - On the Instances page, click the instance name.
- In the navigation pane, click Cold and Hot Data Separation.
- Click Cold Table Configurations and then Collect Statistics.
- When the instance status changes from Collecting cold table data... to Available, the statistics collection is complete. The list displays information about the current cold table, including the cold table name, validity period, and retention period. Figure 15 Cold table information
Table 1 Parameter description Parameter
Description
spaceId
Tablespace ID.
ddId
Table ID.
Name
Database, table, and partition names.
Validity Period (s)
Specifies how many seconds a cold table needs to be retained after being migrated back.
The validity period is related to the retention period in the same-region backup policy. The value is calculated as (Backup retention days + Maximum backup interval) x 24 x 3,600.
Examples:
If the backup cycle is Monday to Sunday (data is backed up every day), the validity period is (Backup retention days + 1) x 24 x 3,600.
If the backup cycle is Monday, Tuesday, Friday, Saturday, and Sunday, the validity period is (Backup retention days + 3) x 24 x 3,600.
If the backup cycle is Sunday, the validity period is (Backup retention days + 7) x 24 x 3,600.
Retained (s)
Specifies how many seconds a cold table has been retained after being migrated back.
Size (MB)
The OBS space occupied by cold table data, in MB.
- If the cold table has been retained for as long as or longer than the validity period, click Delete in the Operation column to remove the cold data remaining in OBS after migration.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot