比较数据库及其锁
我正在进行繁重的事务处理,并希望获得有关如何在当前数据库中实现锁的信息。在零预算的情况下,我的选择仅限于 mysql 5.5 和 postgres 9.0。
有没有比较锁的网站?
从文献中我知道您可以拥有只读锁和读写锁,并且处理锁的一个好方法是阻止数据的路径。这意味着阻塞 b 树的部分内容。但我找不到这些数据库如何工作的细节。
多谢。
I have heavy transaction stuff going on and would like to gain information about how locks are implemented in current databases. Working on zero budget my choise is limited to mysql 5.5 and postgres 9.0.
Is there any site where the locks are compared?
From literature I know that you can have read-only and read-write locks and that a good way of handling locks is to block the the path to the data. That means blocking parts of the btree. But I can't find specifics on how these to databases do their work.
Thanks alot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
的概述
以下是 PostgreSQL http://www.postgresql.org/docs /current/static/explicit-locking.html
http://www.postgresql.org/docs/current/static/locking -indexes.html
不确定“只读锁”是什么意思,但在 PostgreSQL 中,“锁定”表不被读取的唯一方法是使用 ACCESS EXCLUSIVE 模式手动锁定它,即常规 DML 语句不会发生这种情况。只有 DDL 语句(例如 ALTER TABLE)才能实现此目的。
Here is an overview for PostgreSQL
http://www.postgresql.org/docs/current/static/explicit-locking.html
http://www.postgresql.org/docs/current/static/locking-indexes.html
Not sure what you mean with "read-only lock", but in PostgreSQL the only way to "lock" a table from being read is to manually lock it using ACCESS EXCLUSIVE mode which is not something that happens with regular DML statements. Only a DDL statement (such as ALTER TABLE) would achieve this.
也许您会发现这本书很有用:Inside Microsoft SQL Server 2005:存储引擎。阅读“日志记录和恢复”和“锁定和并发”章节。本书中的大量信息适用于当今的许多数据库系统。这真是一本好书。
我建议您阅读有关并发控制的内容。您可以从 Concurrency_control wiki 开始,尤其是“数据库事务和 ACID 规则”部分(
如果您愿意)比较锁,首先我会阅读事务中发生的问题以及事务隔离级别。
Maybe you'll find this book useful: Inside Microsoft SQL Server 2005: The Storage Engine. Read chapters "logging and recovery" and "locking and concurrency". A lot of information from this book is applied to many of today's database systems. It's really good book.
I suggest you to read about concurrency control. You can start from Concurrency_control wiki especially as of section |Database transaction and the ACID rules"
If you wanna compare locks, first I would read about problems occuring in transactions and about transaction isolation levels.
检查这个:SQL Server 2008 锁定.
Check this: SQL Server 2008 Locking.