Overview of Cold and Hot Data Separation
Scenarios
If there are some tables with almost no data reads or writes in your DB instance, you can use cold and hot data separation to dump their data to OBS. This helps reduce costs by managing cold and hot data more efficiently.
Introduction Video
How It Works
TaurusDB allows you to dump infrequently used InnoDB tables to OBS. These dumped tables are called cold tables.
As shown in the figure, the cold and hot data separation architecture supports dynamic data migration between a TaurusDB instance and OBS to balance performance and storage costs. The core workflow is as follows:
- Data dictionary: Stores database metadata, such as table schemas, index definitions, and user permissions. It serves as the database's directory. Regardless of where the data itself resides, the metadata must remain in the data dictionary so that the database engine can locate and manage the data.
- Data files: Store active hot data that requires fast access, along with its associated indexes.
When infrequently accessed cold data needs to be archived, the system creates a cold table, migrating the corresponding data and index files from a TaurusDB instance to OBS. This frees up storage space and reduces storage costs. The metadata remains in the instance's data dictionary, allowing the database to continue recognizing and managing the table. When the application needs to modify or query the data frequently again, the system restores the cold table, migrating the data files from OBS back to the TaurusDB instance to restore high-performance access. The entire process is transparent to applications and requires no code changes, enabling intelligent tiered storage in which hot data delivers fast responses while cold data is stored at a lower cost.
Constraints
- The archiving granularity depends on the table type: Partitioned tables can be archived by individual partition, whereas non-partitioned tables can only be archived as a whole.
- Cold tables support only SELECT queries, which are relatively slow. You are advised to use cold tables for large volumes of infrequently accessed data. Frequently accessed business data should not be converted into cold tables. Extensive use of cold tables may result in a large number of slow query logs.
- To prevent an operation failure, do not create or migrate back a cold table when any other operation is being performed on the instance.
- Cold table data cannot be migrated using DRS. If you need to retain cold table data from the source database during migration, restore the cold tables to the source database before using DRS.
Billing
Cold data is stored on OBS and billed based on the amount of data in cold tables. It does not occupy the backup space. For details, see "Backup Storage Price" in TaurusDB Pricing Details. You can view the cold table size by referring to Collecting Cold Table Statistics.
How to Use
- Dumping cold table data
You can create cold tables on the console. The data of the cold tables is stored on OBS, freeing up storage space and reducing storage costs. For details, see Configuring Cold Tables Using the Console.
- Querying cold table data
Just like querying data from any ordinary table, you can run SELECT statements to query cold table data. For details, see Configuring Cold Tables Using SQL Statements.
The rds_schs_enable_partition_visible parameter controls whether data in archived partitions is visible to SELECT queries. The default value is ON. To modify its value, see Modifying Instance Parameters.
When the parameter is set to ON, data in archived partitions is visible to SELECT queries. When set to OFF, such data is not visible to SELECT queries.
- Modifying cold table data
If you need to modify a cold table that has been stored in OBS, you must first migrate the table back to the DB instance using the console. This operation does not delete the cold table data stored in OBS. To delete data from OBS, submit a service ticket.
- Deleting cold table data
After a cold table is created, you cannot execute DDL statements on it. Therefore, you cannot delete the cold table directly or delete the database that contains it.
To delete a cold table, you must first migrate it back to the DB instance and then run the drop command.
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