Transactions in the database

Source: Internet
Author: User

(1) transaction is the unit of concurrency control and a sequence of user-defined operations. These operations are either done or not done. They are an inseparable unit of work. Through transactions, SQL Server can bind a set of logical operations to ensure data integrity on the server.
(2): transactions generally start with begin transaction and end with commit or rollback.
Commit indicates commit, that is, all operations to commit a transaction. Specifically, all the updates to the database in the transaction are written back to the physical database on the disk, and the transaction ends normally.
Rollback indicates rollback, that is, a fault occurs during the transaction operation, and the transaction cannot continue. The system revokes all the completed operations on the database in the transaction, roll back to the starting state of the transaction.
(3) three modes of transaction operation:
A: automatically submit transactions.
Each separate statement is a transaction. Each statement implies a commit.
B: explicit transactions
Start explicitly with begin transaction and end explicitly with commit or rollback.
C: Implicit transactions
When the previous transaction was completed, the new transaction was started implicitly, but each transaction still ended explicitly with commit or rollback.
(4): ACID properties of transactions)
A: atomicity)
A transaction is the logical unit of work of a database. All operations in a transaction are either performed in full or not.
B: Consistency)
The result of transaction execution must be that the database changes from one consistent state to another consistent state. Consistency is closely related to atomicity.
C: Isolation)
The execution of a transaction cannot be disturbed by other transactions.
D: Durability)
Once a transaction is committed, its changes to the data in the database should be permanent.
Note: transactions are the basic unit for recovery and concurrency control.

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.