Home  >  Article  >  Database  >  SQL SERVER 查询性能优化分析事务与锁(二)

SQL SERVER 查询性能优化分析事务与锁(二)

WBOY
WBOYOriginal
2016-06-07 17:44:481119browse

上接 SQL SERVER 查询性能优化分析事务与锁(一) 第二步,通过SQL 语句分析锁定情况 SQL 通过 master.sys.sysprocesses 视图找出最初锁住资源及导致后面一连串进程被迫停止的等待源头。 下面我们举一个例子来具体说明,以下代码在SQLSERVER2005/2008 中都可

 

上接 SQL SERVER 查询性能优化——分析事务与锁(一)

 

第二步,香港虚拟主机,通过SQL语句分析锁定情况

SQL

通过master.sys.sysprocesses 视图找出最初锁住资源及导致后面一连串进程被迫停止的等待源头。

下面我们举一个例子来具体说明,服务器空间,服务器空间,以下代码在SQL SERVER 2005/2008中都可以使用

.( , (60) NULL, (10) NULL, , , ( ), IGNORE_DUP_KEY , ALLOW_PAGE_LOCKS ) ANSI_PADDING .(, , , , ) , N, 4, 1) .(, , , , ) , N, 3, 2) .(, , , , ) , N, 5, 2) .(, , , , ) , N, 10, 3) .(, , , , ) , N, 7, 1) 例一 master.sys.sysprocesses where spid in (select blocked from master.sys.sysprocesses)) spid 进程,STATUS 状态, 登录帐号=SUBSTRING(SUSER_SNAME(sid),1,30) ,用户机器名称=SUBSTRING(hostname,1,12) ,是否被锁住=convert(char(3),blocked) ,数据库名称=SUBSTRING(db_name(dbid),1,20),cmd 命令,waittype as 等待类型 ,last_batch 最后批处理时间,open_tran 未提交事务的数量 from master.sys.sysprocesses spid test book bookid test Book

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn