Introduction to transactions in the database

Source: Internet
Author: User

1. Definition: A transaction is a user-defined sequence of database operations that are either fully or completely non-operational and are an inseparable unit of work.

2. Main function: Ensure the integrity and validity of database data.

3. For example, in bank data, the operation from account A to 1000 to another account B is comprised of two indivisible operations in the database system: Modify account A, minus the transfer amount of 1000, modify account B and increase the transfer amount by 1000. This behavior is not allowed: only account A has been modified, minus the transfer amount of 1000, and no account B has been modified. A transaction can execute a series of indivisible database operations as a whole.

4. Properties: Acid Properties

Atomicity: A transaction is a logical unit of work for a database, and all operations included in a transaction are either done or not.

Consistency: The result of a transactional execution must be a state in which the database changes from one consistent state to another.

Isolation: The execution of transactions and transactions is isolated, that is to say: The execution of a transaction cannot be disturbed by other transactions.

Persistence: It also becomes permanent, that is to say: Once a transaction is committed, its changes to the data in the database will be permanent.

5. Factors affecting the transaction:

First: A transaction is forced to stop during operation

Second: When multiple transactions are executed, there is a cross between different transaction operations.

Introduction to transactions in the database

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.