MySQL things control and lock statements

Source: Internet
Author: User

MySQL supports table-level locking of tables in the MyISAM and memory storage engines, and row-set locking of tables in the InnoDB storage engine. It is automatically obtained by default.

The lock TABLES can be used to lock the table obtained by the current thread, and if the table is locked by another thread, the current thread waits until the existing lock can be acquired.

UNLOCK TABLES can release any locks that the current thread obtains, when the current thread executes another lock TABLES, or when the connection to the server is closed, all tables locked by the current thread are implicitly unlocked.

The start transaction can open a transaction and commit to Autocommit mode, and commit and chain commit the transaction and open a new transaction at the same isolation level.

V. Opening a new transaction using the start Transaction command during the table will cause an implicit unlock tables to be executed.

Vi. in the same transaction, do not use tables of different storage engines, especially tables that do not support transactions. Typically, only committed transactions are logged to the binary log, but if a transaction contains a non-transactional type of table, the rollback operation is also logged to the binary log to ensure that updates to non-transaction-type tables can be replicated to the database.

VII. All DDL statements cannot be rolled back, and some DDL statements cause implicit commits.

MySQL things control and lock statements

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.