数据库供应商如何实现事务? [英] How do database vendors implement transactions?

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

问题描述

使用数据库时,通常必须使用事务。例如,我想将一定数量的钱从帐户A转移到帐户B.这涉及两个查询:一个用于减少帐户A中的钱,另一个用于增加帐户B中的钱。

When working with database it is often essential to use transactions. Say for example that I want to transfer a certain amount of money from account A to account B. This involved two queries: one for decreasing the money in account A and the other to increase it in account B.

理论上,我可以单独进行查询,但会发生错误。所以,可以肯定的是,我可以在一个事务中打包两个查询,并确保两个操作都定期结束或根本没有改变。没有钱消失或创建。

In theory I can make the queries separately, but errors happen. So, to be sure, I can pack the two queries inside a transaction and be sure that either both operations end regularly or nothing has changed at all. No money disappears or is created.

问题是,在我看来,这只是将责任从我转移到数据库供应商。现在是由数据库来做这两个操作,并确保两者都做或没有更改。

The problem is that it seems to me that this only shifts the responsibility from me to the database vendor. Now it is up to the database to make both operations and be sure that either both are made or nothing has changed. And the database developers face the same problems that errors happen.


数据库供应商使用什么技术来确保交易的安全?

What techniques do database vendors use to ensure safety for transactions?


推荐答案

wikipedia上的ACID - 实现页面将让您开始写前记录,影子分页和多版本并发控制。

The ACID - Implementations page on wikipedia will get you started on write-ahead logging, shadow paging and multi-version concurrency control. Follow the links to find more.

每个DBMS供应商都会根据上下文,完全ACID或宽松需求,分布式事务一致性要求等实现自己的算法,通常有几种不同的算法...

Each DBMS vendor implements their own algorithms, often several different ones depending on the context, full ACID or relaxed requirements, distributed transaction consistency requirements etc...

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

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