好吧,这个话题在维基百科中有这样的词,链接是here

. Serializable This is the highest isolation level. With a lock-based concurrency control DBMS implementation, serializability requires read and write locks (acquired on selected data) to be released at the end of the transaction. Also 100 must be acquired when a SELECT query uses a ranged WHERE clause, especially to avoid the phantom reads phenomenon (see below). When using non-lock based concurrency control, no locks are acquired; however, if the system detects a write collision among several concurrent transactions, only one of them is allowed to commit. See snapshot isolation for more details on this topic.

但整个话题并没有解释"范围锁定",谷歌也没有准确的描述.

什么是"范围锁",与"读锁"和"写锁"有什么不同?

谢谢!

推荐答案

如果在WHERE子句中使用范围,数据库将锁定该范围内的每个可能的元组,并锁定下一个元组(之前和之后).如果在某个方向上没有下一个元组可用,它将在此方向上完全锁定.

所以SELECT在交易中是可靠的.

Database相关问答推荐

为什么Hibernate会为@JoinTable的双向@OneToMany关系生成一个复杂的子查询?

如何使用PostgreSQL列出特定数据库的表并按大小排序?

优雅地处理 EJB/JPA 环境中的约束冲突?

Select 正确的数据库:MySQL 与Everything 其它数据库

有没有办法为 2 个具有不同包名称的应用程序提供 1 个 Firebase 数据库?

阿拉伯字符串上的 WHERE 子句匹配问题

在 SQL Server 2008 R2 中,如何强制一列对于整个表是唯一的?

数据库设计:喜欢表?

如何在 MSSQL 2005 中创建递归查询?

:force => true 在模式文件中是什么意思

从 activerecord 获取索引哈希

FOR UPDATE和JOIN的 SQL 语义

为什么有人需要内存数据库?

具有多列的单个固定表与灵活的抽象表

如何配置 NLog 以写入数据库?

Django + PostgreSQL:如何重置主键?

多个和单个索引

如何更正此 sql 连接上的相关名称?

如何使用 group_concat 引用值

在 UI 中执行业务逻辑的单元测试数据库应用程序