Problems with multiple users manipulating one table at a time

Source: Internet
Author: User
Ask a question
For example, set up a membership number table ID CARDSN (member number) UID CARDSN is continuous like 031001, 031002 now has such a function click on a button to add 5 records and is continuous then each time you need to get the latest membership number and then use this as a benchmark for continuous generation of 5 number of plug The problem with databases is that if multiple users are working on the table at the same time, then each time the latest record is used to be inaccurate. Ask us how this problem should be solved


Reply to discussion (solution)

You can open a transaction.

If 5 users at the same time on the table operation, there is always a sequential, you can refer to the MySQL transaction processing, when you user action table, will lock the table, and so on, other users will continue to operate.
If concurrency is large, it is recommended that the Memcache queue be processed to relieve the pressure on the database tables.

Use queue form to process

If 5 users at the same time on the table operation, there is always a sequential, you can refer to the MySQL transaction processing, when you user action table, will lock the table, and so on, other users will continue to operate.
If concurrency is large, it is recommended that the Memcache queue be processed to relieve the pressure on the database tables.

Many other operations will use this table to lock the table will not affect other operations

Use queue form to process

Can you give me a specific idea?

Use things?
The first table, the end of the management and then the release.
? Test: http://koda.iteye.com/blog/471713

Use things?
The first table, the end of the management and then the release.
? Test: http://koda.iteye.com/blog/471713

Thank you for the knot.

Use things?
The first table, the end of the management and then the release.
? Test: http://koda.iteye.com/blog/471713

Can you ask a question my database is now a table of MyISAM type if you use the lock table in the unlocked form that other operations will not be affected when using this table for example, when you lock a table, you perform an insert operation, and another operation is to query the table. Will the query be affected?

The lock table is the original parallel operation into a serial operation
Of course to affect the performance of

The lock table is the original parallel operation into a serial operation
Of course to affect the performance of

The owner asked another question, such as the lock table when the purpose is to insert 5 records to this table other operations such as registration will also be inserted into this table data then there may be insert failure, right?

A table lock is used to create a queue, but does not cause an insert to fail

A table lock is used to create a queue, but does not cause an insert to fail

Thank you for your enthusiastic answer.

Thank you for your enthusiastic reply.

  • Related Article

    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.