Database principle: Transaction acid characteristics of relational database

Source: Internet
Author: User

Transaction is the core of relational database, and relational database has flourished in the past few decades, and its support to the transaction is inseparable. But the so-called Chengye, Shenya, with the explosion of data volume, especially in recent years, the rapid development of large data, relational database transactions become the Internet application of performance bottlenecks, NoSQL is to abandon the relational database transactions of some attributes, so that for a certain kind of special applications, Its performance is many times the size of a relational database.

Let's talk about what is a business, the business in English is transaction, and real world transactions are very similar, it has the following four characteristics:

1, A (atomicity) atomicity

Atomicity is easy to understand, that is to say, all operations in a transaction are either completed or not, and the success of the transaction is the success of all operations in the transaction, as long as one operation fails, the entire transaction fails and needs to be rolled back.

For example, bank transfer, from a account to transfer 100 to B account, divided into two steps: 1 from a account to 100 yuan, 2 to deposit 100 yuan to B account. These two steps are either completed together, or together do not complete, if only to complete the first step, the second failure, the money will be inexplicably less than 100 yuan.

2, C (consistency) consistency

Consistency is also relatively easy to understand, that is, the database should always be in a consistent state, the operation of the transaction will not change the original database consistency constraints.

For example, an existing integrity constraint a+b=10, if a transaction changes A, then the B must be changed so that the transaction still satisfies the a+b=10, otherwise the transaction fails.

3, I (isolation) Independence

The so-called independence is that the concurrent transactions do not affect each other, if a transaction to access data is being modified by another transaction, as long as another transaction is not committed, the data it accesses is not affected by uncommitted transactions.

For example, there is a transaction from a account to transfer 100 Yuan to B account, in the case of the transaction has not been completed, if at this time B inquires their account, is not see the new increase of 100 yuan.

4, D (durability) Durability

Persistence means that once a transaction has been committed, its modifications will be persisted to the database, even if there is downtime.

Or the example above, if the transfer is successful, and the database is down, after the restart, you can still see the results of the successful transfer.

The following describes a cattle man--james Gray, he has made an indelible contribution to relational database transactions:

Defines the transaction and solves the problem of data consistency perfectly.

The mechanism of the lock is proposed,

Put forward the control of the things in the log.

A two-stage submission technique (2PC) is proposed.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/basis/

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.