MySQL Transaction (ii)--Control statement usage

Source: Internet
Author: User
Tags savepoint

Transaction control

In general, MySQL turns on the transaction autocommit feature by default, and each SQL execution commits the transaction. You can turn off the transaction autocommit feature by using the following statement.

Show session variables like ' autocommit ', set @ @autocommit = 0;show Session variables like ' autocommit ';

1. Start of transaction

Begin or start transaction;

2. Transaction Submission

Commit or commit work;

3. Rollback

Rollback or rollback work;

4, Save point settings

SavePoint identification;

5. Roll back to SavePoint

Rollback to SavePoint logo;

6. Delete the savepoint

Release savepoint identification.

Transaction isolation

read-uncommitted READ UNCOMMITTED

Read-committed Read submitted

Repeatable-read Repeat Read

Serialization of SERIALIZABLE

Dirty Read

Non-stressed

Phantom reading

read-uncommitted

Y

Y

Y

read-committed

N

Y

Y

Repeatable-read

N

N

Y

SERIALIZABLE

N

N

N

Dirty reads: Reading data is another transactional process data, and reading it may be wrong.

Non-stressed: the second read data content is different from the first read data content. (No read transaction process data exists)

Phantom reads: The number of rows of data read the second time is more or less than the first read. (No read transaction process data exists)

MySQL Transaction (ii)--Control statement usage

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.