In highly concurrent scenarios, when an insertupdatedelete operation is performed on a table, what happens if update fails?

Source: Internet
Author: User
For example, the specific operation on a table in the title. For example, the next access will contain three operations. After the user submits data into a temporary table, a determines based on the business logic, one of the fields in update is the data processed by the 3insert temporary table to the formal Table B. Recently, it was found that the temporary data is submitted too frequently... for example, the specific operation of the title on a table is as follows:

One access will contain three operations

  1. Insert data submitted by the user to a temporary Table
  2. After judging based on the business logic, one of the update fields is 3
  3. Insert the data processed by the temporary table to table B to delete the temporary data.

Recently, it is found that the update operation fails when too many submissions are submitted, and the update is invalid.

What is the cause of this? Is there any solution? Is it related to the lock?

Reply content:

For example, the specific operation of the title on a table is as follows:

One access will contain three operations

  1. Insert data submitted by the user to a temporary Table
  2. After judging based on the business logic, one of the update fields is 3
  3. Insert the data processed by the temporary table to table B to delete the temporary data.

Recently, it is found that the update operation fails when too many submissions are submitted, and the update is invalid.

What is the cause of this? Is there any solution? Is it related to the lock?

Check what engine your temporary table is. If it is MyISAM, we recommend that you do not delete it after processing each time. You can add a clear list to the row and delete it regularly.

In addition, the insert/update/delete MyISAM engine locks the table, so other operations will be blocked. If your database configures the blocking timeout time, the update may fail.

I do not recommend using innodb either, unless you have configuredInnodb_table_per_file = 1.

First, we recommend that you do not place temporary data in database tables. You can consider storing it in the cache system.

Second Suggestion: Clear invalid data regularly.

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.