Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 锁定多行_Sql_Postgresql_Activerecord_Locking - Fatal编程技术网

Sql 锁定多行

Sql 锁定多行,sql,postgresql,activerecord,locking,Sql,Postgresql,Activerecord,Locking,是否可以一次锁定postgresql中的多行以防止更新?我浏览了官方锁,可以找到在表级和行级工作的锁,但在多行上没有 在postgresql中可以这样做吗?参考文档: 例如: select * from my_table where id < 10 for update 选择* 从我的桌子上 其中id

是否可以一次锁定postgresql中的多行以防止更新?我浏览了官方锁,可以找到在表级和行级工作的锁,但在多行上没有


在postgresql中可以这样做吗?

参考文档:

例如:

select *
from my_table
where id < 10
for update
选择*
从我的桌子上
其中id<10
更新

选择。。。对于更新
-或者更高效:只需更新这些行,它们将被锁定,直到您提交事务。当锁定多行(并行)时,会出现死锁