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

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

问题描述

在使用数据库时,使用事务通常是必不可少的.举个例子,我想从账户 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 involves two queries:

  • 减少账户A中的钱
  • 在帐户 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?

推荐答案

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天全站免登陆