从其他线程中选择更新以及“select count clause”

时间:2021-06-17 14:16:20

As per our requirement, we lock a table with select for update lock while fetching the data. This way, no other thread picks up that data.

根据我们的要求,我们在获取数据时锁定一个带有select for update lock的表。这样,没有其他线程获取该数据。

I just wanted to confirm if select count(*) from table where column1=value1 will retrieve locked rows.

我只是想确认从table1 = value1的表中选择count(*)是否将检索锁定的行。

If yes, will it retrieve recent changes made at the end of select for update locking (i.e. will it wait for rows to be updated) or stale data will be shown?

如果是,它是否会检索在select更新锁定结束时所做的最近更改(即它是否会等待更新行)或是否会显示过时数据?

Thanks,

1 个解决方案

#1


0  

1 . It depends on the TX isolation level.

1。它取决于TX隔离级别。

2 . Lock means stop and wait but not skip.

2。锁定意味着停止并等待但不跳过。

#1


0  

1 . It depends on the TX isolation level.

1。它取决于TX隔离级别。

2 . Lock means stop and wait but not skip.

2。锁定意味着停止并等待但不跳过。