Mysql-find a piece of php logic code

Source: Internet
Author: User
Similar to the comment function, Table 1 contains the floor, time, and text fields. It is best to have php code similar to the comment function to implement floor auto-increment and lock during insertion (to prevent high concurrency and same floor ).
Table 1 contains the floor, time, and text fields.
How to Implement floor auto-increment and lock upon insertion (to prevent high concurrency from being the same as floor), it is best to have php code

Reply content:

Features similar to comments
Table 1 contains the floor, time, and text fields.
How to Implement floor auto-increment and lock upon insertion (to prevent high concurrency from being the same as floor), it is best to have php code

When creating a table, it means that the floor is auto-incrementing. For example
Create table 1 (
Floor int not null auto_increment primary,
Time...
)....
If the table has been created, use alter to modify it.
In this way, we can't repeat it, and it has nothing to do with high concurrency.

When creating a database, you must not only set floor to auto_increment, but also the storage engine to innodb. innodb is a row lock, Data Writing is paging, and myisam is a table lock, it is written by the server guard.

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.