tencent cloud

TencentDB for MySQL

Release Notes and Announcements
Release Notes
Product Announcements
User Tutorial
Product Introduction
Overview
Strengths
Use Cases
Database Architecture
Resource Isolation Policy
Economical Instance
Feature List
Database Instance
High Availability (Multi-AZ)
Regions and AZs
Service Regions and Service Providers
Kernel Features
Overview
Kernel Version Release Notes
Functionality Features
Performance Features
Security Features
Stability Features
TXRocks Engine
LibraDB Engine
Checking and Fixing Kernel Issues
Purchase Guide
Billing Overview
Selection Guide
Purchase Methods
Renewal
Payment Overdue
Refund
Pay-as-You-Go to Monthly Subscription
Instance Adjustment Fee
Backup Space Billing
Database Audit Billing Overview
Commercial Billing and Activity Description for Database Proxy
Description of the Database Proxy Billing Cycle
Viewing Bills
Getting Started
Overview
Creating MySQL Instance
Connecting to MySQL Instance
SQL Insight (Database Audit)
Overview
Viewing Audit Instance List
Enabling Audit Service
Viewing Audit Log
Log Shipping
Configuring Post-Event Alarms
Modifying Audit Rule
Modifying Audit Services
Disabling Audit Service
Audit Rule Template
SQL Audit Rule (Legacy)
Viewing Audit Task
Authorizing Sub-User to Use Database Audit
MySQL Cluster Edition
Introduction to TencentDB for MySQL Cluster Edition
Creating TencentDB for MySQL Cluster Edition Instance
Maintenance Management Instance
Viewing Instance Monitoring
Adjusting Instance Configuration
Operations for Other Features
Migrate or upgrade to TencentDB for MySQL Cluster Edition
Operation Guide
Use Limits
Operation Overview
Instance Management and Maintenance
Instance Upgrade
CPU Elastic Expansion
Read-Only/Disaster Recovery Instances
Database Proxy
Database Management Center (DMC)
Account Management
Parameter Configuration
Backup and Rollback
Data Migration
Network and Security
Monitoring and Alarms
Log Center
Read-Only Analysis Engine
Tag
Practical Tutorial
Using TencentDB for MySQL to Upgrade MySQL 5.7 to MySQL 8.0
Methods and Instructions for Upgrading from MySQL 5.6 to MySQL 5.7
Cybersecurity Classified Protection Practice for Database Audit of TencentDB for MySQL
Building All-Scenario High-Availability Architecture
Usage Specifications of TencentDB for MySQL
Configuring Automatic Application Reconnection
Impact of Modifying MySQL Source Instance Parameters
Limits on Automatic Conversion from MyISAM to InnoDB
Creating VPCs for TencentDB for MySQL
Enhancing Business Load Capacity with TencentDB for MySQL
Setting up 2-Region-3-DC Disaster Recovery Architecture
Improving TencentDB for MySQL Performance with Read/Write Separation
Migrating Data from InnoDB to RocksDB with DTS
Building LAMP Stack for Web Application
Building Drupal Website
Calling MySQL APIs in Python
The primary and secondary instances have inconsistent query data
White Paper
Performance White Paper
Security White Paper
Troubleshooting
Connections
Performance
Instance Data Sync Delay
Failure to Enable Case Insensitivity
Failure to Obtain slow_query_log_file via a Command
API Documentation
History
Introduction
API Category
Instance APIs
Making API Requests
Data Import APIs
Database Proxy APIs
Database Audit APIs
Security APIs
Task APIs
Backup APIs
Account APIs
Rollback APIs
Parameter APIs
Database APIs
Monitoring APIs
Log-related API
Data Types
Error Codes
FAQs
Related to Selection
Billing
Backup
Rollback
Connection and Login
Parameter Modifications
Instance Upgrade
Account Permissions
Performance and Memory
Ops
Data Migration
Features
Console Operations
Logs
Event
Database audit
Instance Switch Impact
API 2.0 to 3.0 Switch Guide
Service Agreement
Service Level Agreement
Terms of Service
Reference
Standards and Certifications
Contact Us
Glossary

Hotspot Update

PDF
Focus Mode
Font Size
Last updated: 2025-10-27 18:06:10

Feature Description

The hotspot update feature is an optimization capability designed for high-concurrency scenarios, primarily addressing the performance bottleneck issues that arise from multiple requests simultaneously updating the same database record (referred to as a "hotspot row") in business cases such as flash sales and limited-time sales.
When a hotspot update protection task is created, the system automatically detects whether there are single-row hotspot updates. If they are identified, the system logically groups the transactions with hotspot row update conflicts into multiple groups. Within the same group, transactions can execute other statements in parallel in addition to updating the hotspot row. This approach reduces the concurrency performance degradation risks due to excessive row locks, thereby improving database performance in high-concurrency scenarios. Hotspot update protection tasks can be created, viewed, disabled, and deleted through the DBbrain console.
The core working principle of the feature can be simply put as the following process:
1. Automatic detection: The system monitors the update operations on the database in real time and automatically identifies the specific data rows that are updated frequently.
2. Request queuing: Once a hotspot row is identified, the system places subsequent concurrent update requests for that row into a waiting queue.
3. Transaction waiting and wakeup: After logical grouping, transactions within the group will only require serialization when hotspot update statements are executed; other statements can be executed in parallel.

Supported Versions

MySQL 5.7 20250330 or later versions support hotspot update optimization based on the primary key and unique key.
MySQL 8.0 20241001 or later versions support hotspot update optimization based on the primary key.

Applicable Scenarios

The feature is mainly used for business scenarios such as flash sales and limited-time sales, solving the database performance bottleneck issues caused by a large number of users simultaneously updating the same data (such as inventory).
In scenarios where the execution time of transactions is inherently long or where there are both long and short transactions, using this feature can enhance execution performance.

Feature Strengths

It does not need business transformation.
It offers broader SQL compatibility, supporting multiple SELECT FOR UPDATE, UPDATE, or INSERT SQL statements within a single transaction.
Previously, transactions that needed to update hotspot rows could only be started after the previous transaction was committed. Now, these transactions can be executed immediately after the previous transaction is updated, which significantly shortens the lock waiting time for transactions.

Performance Data

Instance specification configuration: MySQL 8.0 exclusive - 32 cores, 256,000 MB of memory, and 200 GB of storage space.
After the hotspot update feature is enabled, the TPS of TencentDB for MySQL can stabilize at around 30,000, meeting actual business requirements.


Feature Usage Must-Knows

The applicable transaction mode is as follows. "a" cannot be an indexed key; otherwise, it does not take effect.
BEGIN;
xxx
UPDATE table_name SET a=? WHERE id/pk=?;
yyy
COMMIT;
The method of using unique key hotspot updates is to add the Hint to the SQL: /*+ TXSQL_UK_HOT_UPDATE */. The example is as follows.
UPDATE /*+ TXSQL_UK_HOT_UPDATE */ table_name SET a=? WHERE uk=?;
When the hotspot update feature is used, set the value of the thread_handling parameter to one-thread-per-connection.

Use Limits of the Feature

Load Limit

A transaction cannot perform multiple UPDATE operations on the same hotspot record.
After the hotspot UPDATE operation is completed in the transaction, subsequent statements should not conflict with each other. Although they may not form a hotspot, they may cause a hang issue.
Multiple hotspots cannot be updated within the same transaction.
Hotspot rows cannot be deleted during hotspot update load.

Parameter Limits

The thread pool mode is not supported currently.
The Binlog should be enabled, and the binlog_order_commits parameter should be set to ON. If the Binlog is disabled, the innodb_hot_update_detect parameter cannot be enabled. If the innodb_hot_update_detect parameter is enabled and there are still hotspot updates in the load, Binlog cannot be disabled at that time.
To disable the parameter innodb_hot_update_detect, you should wait for the current hotspot update in the current load to be completed.

SELECT FOR UPDATE Limits

Both SELECT FOR UPDATE and UPDATE should perform a single update based on the primary key index, with consistent update conditions.
SELECT FOR UPDATE should be executed before UPDATE.

Unique Key Limits

The transaction mode of SELECT UK FOR UPDATE followed by UPDATE UK is not supported.
In the same transaction, updating a hotspot row first using the primary key and then using the unique key is not allowed. If Transaction 1 uses the primary key and Transaction 2 uses the unique key to update the same row, this hybrid update method is supported.

Feature Usage

TencentDB for MySQL provides the following two methods to enable the hotspot update feature.

Method 1: Enabling the Feature Through the DBbrain Console

For detailed operation steps, see Creating a Hotspot Update Protection Task.

Method 2: Enabling the Feature Through Parameters

Note:
For details of using the following related parameters, you need to submit a ticket for application. For the operating method of setting parameters, see Setting Instance Parameters.
The hotspot update feature is enabled by setting the value of the parameter innodb_hot_update_detect to ON.

Relevant Parameter Description

Parameter Name
Dynamically Provisioned
Type
Default Value
Valid Value
Description
innodb_hot_update_detect
yes
string
ON
ON/OFF
Whether to enable the hotspot update feature.
ON: indicates enabled.
OFF: indicates disabled.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback