ACID和数据库事务如何工作? [英] How do ACID and database transactions work?

查看:78
本文介绍了ACID和数据库事务如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ACID与数据库事务之间是什么关系?

What is the relationship between ACID and database transaction?

ACID是给数据库事务还是同一件事?

Does ACID give database transaction or is it the same thing?

有人可以启发这个话题。

Could someone enlighten this topic.

推荐答案

ACID 是在修改数据库时要应用的一组属性。

ACID is a set of properties that you would like to apply when modifying a database.


  • 原子性

  • 一致性

  • 隔离

  • 耐久性

  • Atomicity
  • Consistency
  • Isolation
  • Durability

事务是一组相关的更改,用于实现某些ACID属性。事务是实现ACID属性的工具。

A transaction is a set of related changes which is used to achieve some of the ACID properties. Transactions are tools to achieve the ACID properties.

原子性意味着您可以保证所有事务都会发生,或者没有任何事情发生;您可以将一个或多个组件作为一个整体来进行复杂的操作,而崩溃,电源故障,错误或其他任何事情都不会使您处于仅发生某些相关更改的状态。

Atomicity means that you can guarantee that all of a transaction happens, or none of it does; you can do complex operations as one single unit, all or nothing, and a crash, power failure, error, or anything else won't allow you to be in a state in which only some of the related changes have happened.

一致性表示您保证数据将保持一致;

Consistency means that you guarantee that your data will be consistent; none of the constraints you have on related data will ever be violated.

隔离意味着一个事务无法从另一个尚未完成的事务中读取数据。如果两个事务同时执行,则每个事务都将看到世界,就像它们在顺序执行一样;如果一个事务需要读取另一事务写入的数据,则必须等到另一个事务完成。

Isolation means that one transaction cannot read data from another transaction that is not yet completed. If two transactions are executing concurrently, each one will see the world as if they were executing sequentially, and if one needs to read data that is written by another, it will have to wait until the other is finished.

持久性是指事务完成后,可以确保所有更改都已记录到持久性介质(例如硬盘)上,并且可以确保事务已完成

Durability means that once a transaction is complete, it is guaranteed that all of the changes have been recorded to a durable medium (such as a hard disk), and the fact that the transaction has been completed is likewise recorded.

因此,交易是保证这些属性的一种机制。它们是将相关动作组合在一起的一种方式,这样,从整体上讲,一组操作可以是原子的,可以产生一致的结果,可以与其他操作隔离开来,并且可以进行持久记录。

So, transactions are a mechanism for guaranteeing these properties; they are a way of grouping related actions together such that as a whole, a group of operations can be atomic, produce consistent results, be isolated from other operations, and be durably recorded.

这篇关于ACID和数据库事务如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆