摘要:
什么是死锁?==============A deadlock occurs when two system server process IDs (SPIDs) are waiting for a resource and neither process can advance because the other process is preventing it from getting the resource. For example, Andrew holds a lock on table A and requests a lock on table B; Lindsay holds 阅读全文
posted @ 2013-06-03 14:27
Vincent.Dr
阅读(329)
评论(0)
推荐(0)
摘要:
1. 与SQL相关的timeout, 都是由Client端发起的.比如说, 我们自己写了个C#小程序, 其中使用了SqlCommand.CommandTimeout属性, 指定它的值为20秒. 那么, 当这个query在SQL端执行了二十秒后, 我们的C#小程序会给SQL Server发送一个TDS Tension数据包, 告诉SQL Server我这边超时了, 你那边的query不用做了. 于是SQL相应client的请求, 断掉connection. Client端报出一条exception, 说SQL Server端的运行时间太长, 超过了我们原定的时限.2. 那么SQL Server 阅读全文
posted @ 2013-06-03 11:52
Vincent.Dr
阅读(1426)
评论(0)
推荐(0)
摘要:
NOLOCK============使用NOLOCK, 你会告诉SQL Server去忽略掉locks, 直接从表中读取数据. 这意味着你规避了SQL Server的锁系统, 会大幅度地提高性能和可扩展性.然而, 既然你完全地绕过了锁系统, 也就意味着你的代码存在着读取了脏数据的风险. 你也许会读取到没有在一个transaction中被committed的不合法的数据. 这很危险.ROWLOCK============使用ROWLOCK, 你会告诉SQL Server去仅仅使用row-level的lock. 在SELECT, UPDATE, 和DELETE语句中, 你可以使用这个关键字, 但是 阅读全文
posted @ 2013-06-03 11:36
Vincent.Dr
阅读(242)
评论(0)
推荐(0)

浙公网安备 33010602011771号