Transaction (Process ID ) was deadlocked on lock resources with another process and has been chosen
来源:互联网 发布:配置低的网络电视 编辑:程序博客网 时间:2024/05/03 00:56
You had written update or delete statements without SQL hints like nolock, updlock, readpast etc.
This is very bad practice when you are dealing with multiple udates on rows or tables without locks.
Below scenario will explain how to use those hints to avoid deadlocks aswell as concurrency issues.
e.g.
UPDATE top 10 xyzTable with (updlock)
set x = 1
In this case if second user comes in to update xyzTable, he has to wait for first user operation to finish.
To let second user do update on next top 10 rows which are not locked by first user, you can
modify above query using readpast hint.
ReadPast hint will return row sets which are not locked by any transaction in that contxt.
UPDATE top 10 xyzTable with (updlock,readpast)
set x = 1
This is very bad practice when you are dealing with multiple udates on rows or tables without locks.
Below scenario will explain how to use those hints to avoid deadlocks aswell as concurrency issues.
e.g.
UPDATE top 10 xyzTable with (updlock)
set x = 1
In this case if second user comes in to update xyzTable, he has to wait for first user operation to finish.
To let second user do update on next top 10 rows which are not locked by first user, you can
modify above query using readpast hint.
ReadPast hint will return row sets which are not locked by any transaction in that contxt.
UPDATE top 10 xyzTable with (updlock,readpast)
set x = 1
ReadPast and NoLock are two different hints
Readpast Only return rows which are not locked, while nolock returns
commited as well as non commited rows by other transaction this is also called as dirty reads.
SP_LOCK will written locks details.
You can avoid concurrency issues with your transaction using those lock hints.
For more information about locks in MS SQL you can visit
http://msdn.microsoft.com/en-us/library/aa213026(SQL.80).aspx
- Transaction (Process ID ) was deadlocked on lock resources with another process and has been chosen
- Transaction (Process ID) was deadlocked on lock resources with another process and has been chose
- Process Resources
- Process ID and special processes
- get android process id and thread id
- All About Process On Value and Process On Help
- All About Process On Value and Process On Help
- Web site worker process has been terminated by IIS
- process on
- Agile Development with ICONIX Process: People, Process, and Pragmatism
- How to launch another process in sandbox on Mac
- WebLogic Server (WLS) Hangs With Deadlocked Socket Close() and Poll() Threads on AIX 【转】
- Business Process Modeling and Simulation with UML
- There was a problem with reindexing process 解决方法
- was active for 79985 milliseconds and has been removed automaticaly.
- 解决VTune错误PMU resources currently being used by another profiling tool or process
- zombie process and orphan process
- zombie process and orphan process
- inverse 减少hibernate一条更新记录
- 第二章 .Net 控件开发(WebForm) 开发自定义复合控件(2) 重写属性和方法
- 我的生涯
- 让putty显示中文
- JS控制网页中Flash影片的播放(附带各参数)
- Transaction (Process ID ) was deadlocked on lock resources with another process and has been chosen
- Java中JDK的安装和path,classpath的环境配置
- 最老程序员创业札记:全文检索、数据挖掘、推荐引擎应用32
- RHEL5.4 命令行分区
- 史上最佳十大游戏排名 魔兽世界位列第十
- 【转】 IOCP内存管理
- 程序员是懒惰反复无常的伪知识分子,果真如此吗?
- 单链表建立,插入,删除,查找,遍历操作
- ubuntu开启SSH服务