Exercise caution when using MySQLauto_increment

Source: Internet
Author: User

When using MySQL, you often create an auto-increment ID field in the table and use the auto-increment ID to quickly create an index. This is also a recommended method for MySQL. However, this method may cause synchronization failure due to auto-increment ID when a large amount of data is configured and master/Slave nodes are 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.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.