Exercise caution when using MySQLauto_increment_MySQL
Source: Internet
Author: User
Exercise caution when using MySQLauto_increment in MySQL, you will often create an auto-increment ID field in the table and use the auto-increment ID to quickly create an index. this is also officially recommended by MySQL, however, this method may cause synchronization failure due to auto-increment ID when a large amount of data is configured and master-slave data is configured. First, you need to know that Mysql master-slave synchronization is mainly synchronized through the bin log, in MySQl, the maximum bin log value is 1 GB. the database is configured for master-slave synchronization. 2. the table has self-incrementing ID3, and the table has a large amount of data,
If insert into… is executed on the master... Select... When the SQL transaction exceeds 1 GB, MySQL will synchronize the SQL statement in row mode from top to bottom to insert into values (.......), at this time, the data volume exceeds 1 GB, that is, the maximum value allowed by MySQL bin log is exceeded. Therefore, the master-slave synchronization fails, only the auto-increment field can be deleted to restore the master and slave databases. Therefore, when the data volume is large and the above calculation SQL table exists, use the auto-increment field with caution.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service