此外,答案会根据答复的大小而有所不同吗?如果它只需要返回几KB到几百MB,那会有所作为吗?
解决方法
If client takes long time to receive data and in turn send
acknowledgement to sql Server that it has received the data sql Server
has to wait,due to this wait sql Server will not release the locks
held by the query unless acknowledgement is received from client.
这不准确,它取决于隔离级别.
在默认情况下,READ COMMITTED锁定在语句执行期间不会保留. READ COMMITTED不提供语句级读取一致性,唯一的保证是您无法读取未提交的数据.获取并保持共享锁以读取该行然后释放.
除非你有LOB类型.
LOB类型可能非常大,无法缓冲.必须获取并保持共享锁,直到语句完成,基本上在READ COMMITTED处给出REPEATABLE READ行为.
If I’m making a single call to an MSsql database over a high-latency
network,will table locks occur due to that latency?
延迟不会导致表锁定,不会.但是,如果已获取表锁,延迟将延长它.
引用一个比我更了解这种机制的人(@RemusRusanu):
Results are returned back to the client program as the execution
proceeds. As rows ‘bubble’ up the execution tree,the top operator is
usually tasked with writing these rows into network buffers and
sending them to back to the client. The result is not created first
into some intermediate storage (memory or disk) and then sent back to
the client,instead it is sent back as is being created (as the query
executes). Sending the result back to the client is,of course,
subject to the network flow control protocol. If the client is not
actively consuming the result (eg. by calling sqlDataReader.Read())
then eventually the flow control will have to block the sending side
(the query that is being executed) and this in turn will suspend the
execution of the query. The query resumes and produces more results
(continue iterating the execution plan) as soon as the network flow
control relieves the required network resources. 07001
如果结果没有像sql Server提供的那样快速消耗,无论是客户端还是网络,我们都会看到ASYNC_NETWORK_IO等待累积.重申一下,这不会影响所获得的锁,只会影响它们的持续时间.