首页 > 数据库技术 > 详细

sql server 死锁自动释放

时间:2019-11-04 19:23:32      阅读:154      评论:0      收藏:0      [点我收藏+]

在高并发时数据库发生会死锁,发生死锁后,数据库会自动释放

技术分享图片

 

 

原文:

When a transaction is chosen as a deadlock victim, SQL Server will rollback the victim‘s transaction which releases locks held by the transaction. This will allow other transactions to proceed.

Unlike blocking, deadlocks do no persist for long periods. If a query times out or an impatient user cancels a blocked query during execution (attention event), no further T-SQL code on the connection is executed, including the CATCH block. The transaction will remain open (with locks held) unless the XACT_ABORT session setting is set. For this reason, I suggest you specify SET XACT_ABORT ON in stored procedures with explicit transactions. See http://weblogs.sqlteam.com/dang/archive/2007/10/20/Use-Caution-with-Explicit-Transactions-in-Stored-Procedures.aspx.

Note that long-term blocking can sometimes lead to deadlocks. To improve concurrency, I suggest you review your query execution plans for query and index tuning opportunies. This will help ensure that only the data actually needed is touched and locked.

sql server 死锁自动释放

原文:https://www.cnblogs.com/fishyues/p/11793856.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!