冗长的select语句锁定表 [英] lengthy select statement locks the table

查看:81
本文介绍了冗长的select语句锁定表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

有什么方法可以执行冗长的select语句,使它不应该锁定表.我应该在select语句中添加些什么.

谢谢,
Jagjot

Hello Friends,

What are the ways available to execute a lengthy select statement so that it should not lock the table. What should I add to select statement.

Thanks,
Jagjot

推荐答案

没有锁定

像这样的东西:
WITH NOLOCK

Something like:
SELECT * FROM MyTabel WITH (NOLOCK)



在这里阅读:
锁定提示 [表格提示 [



Have a read here:
Locking Hints[^]
Table Hints[^]

If needed, just Google for more.


您好,

问题之一是,在正常操作中,例如,需要共享锁来防止脏读.

一种可能是使用在数据库级别定义的行版本控制:
SQL Server中使用行版本的数据版本控制 [ ^ ].实际上,这并不是您所要求的,因为仍然使用锁,例如,排他锁将不再阻止读取等.

问候,

mika
Hi,

One of the problems is that in normal operation shared locks are needed for example to prevent dirty reads.

One possibility is to use row versioning which is defined at database level: Data versioning in SQL Server using row versions[^]. Actually this isn''t exactly what you asked since locks are still used but for example exclusive locks won''t block reading anymore etc.

Regards,

mika


这篇关于冗长的select语句锁定表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆