MySQL Learning (a) business

Source: Internet
Author: User
Tags rollback
1. Four characteristics of a transaction (ACID)

Analyzed by the transfer business.

A. atomicity

The operational steps of a transaction are inseparable, either all succeed or all fail. A to B transfer, a If the debit, B must increase the balance, A and B account changes at the same time, or failure.

B. Consistency

Transactional consistency means that the database must be in a consistent state before and after a transaction is executed. This attribute is called transactional consistency. If the state of the database satisfies all the integrity constraints, the database is said to be consistent.

For example, integrity constraint a+b=10, a transaction changes A, then B should change as well.

C. Isolation

Concurrent transactions are isolated from each other. That is, the operations within a transaction and the data being manipulated must be blocked from being seen by other transactions attempting to modify it. The execution of multiple concurrent transactions that manipulate the same shared object can cause an exception if there is no control over the concurrent cross-executing transactions.

D. Persistence

Persistence means that updates to committed transactions cannot be lost when a system or media failure occurs. That is, once a transaction commits, the DBMS guarantees that its changes to the data in the database should be permanent, that is, the update to the committed transaction can be restored. Persistence is ensured through database backup and recovery.

2. Start and end of a transaction

A. Start of a transaction using the start Transaction command

B. End of transaction using a commit or rollback command (rollback can roll the transaction back to the state before the transaction begins)

MySQL Learning (a) business

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.