Detailed Database transactions

Source: Internet
Author: User

Transactions: A transaction is the basic unit of recovery and concurrency control and is a user-defined sequence of operations. These operations are either done or not, and are an inseparable unit of work. A logically related set of operations is bound together through a transaction so that the server maintains the integrity of the data.

Transactions Four features: 1. atomicity: Each operation in a transaction is either done or not done

2. Consistency: A transaction must transform a database from one consistent state to another

3. Isolation: Execution of one transaction cannot be disturbed by other transactions

4. Permanent: Once a transaction is committed, its changes to the data in the database should be permanent

Dirty reads: Data from another uncommitted transaction is read in one transaction process

Non-REPEATABLE READ: Multiple queries within a transaction return different data values (emphasis on update)

Phantom reads: One transaction range multiple queries return different data values (emphasizing insert,delete)

Five isolation levels in sring:

Transaction_none: Do not use transactions

Transaction_read_uncommitted: Allow dirty reads

Transaction_read_committed: Prevent dirty reads, most commonly used isolation levels, most databases default isolation levels

Transaction_repeatable_read: Prevent dirty reads and non-repeatable reads

Transaction_serializable: Prevent dirty reading, non-repeatable reading, phantom reading, low efficiency

Detailed Database transactions

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.