In-depth explanation of mysql concurrent insert Optimization _ MySQL

Source: Internet
Author: User
In-depth explanation of mysql concurrent insertion optimization bitsCN.com

When using storm to process logs, we often encounter the efficiency problem of inserting mysql concurrently. I checked some information online and made some notes.

Change the table engine to myisam,

Modify the concurrent_insert = 2 of my. cnf. The value of concurrent_insert can be 0 1 2, and 2 completely supports concurrent inserts.

1) concurrent _ insert = 0,Concurrent insert is not allowed no matter whether the table data file in MyISAM is deleted and leaves Russian free space.

2) concurrent_insert = 1,When there is no free space in the data file of the MyISAM storage engine table, run Concurrent Insert from the end of the file.

3) concurrent_insert = 2,Whether the middle part of the table data file of the MyISAM storage engine exists free space due to deletion, the concurrent insert operation can be performed at the end of the data file.

Restart mysql:/etc/init. d/mysqld restart

When inserting data, you can also set it to delayed insert: insert delayed into 'tablename '......

BitsCN.com

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.