SQL Server query performance optimization and analysis of transactions and locks (1) Step 2: analyze the locking status using SQL statements. sys. in the sysprocesses view, find out the source of waiting for the initial lock of resources and the subsequent processes to be forced to stop. The following code is applicable to both SQLSERVER20052008 and SQLSERVER20052008.
SQL server query performance optimization analysis of transactions and locks (1) Step 2: analyze the locking status using SQL statements. SQL uses the master. sys. in the sysprocesses view, find out the source of waiting for the initial lock of resources and the subsequent processes to be forced to stop. The following code is applicable in SQLSERVER2005/2008.
SQL server query performance optimization-analysis of transactions and locks (I)
Step 2: analyze the locking status of a VM in Hong Kong using SQL statements
SQL
Use the master. sys. sysprocesses view to find out the waiting source that initially locks the resource and causes the subsequent processes to be forced to stop.
The following code describes the SERVER space and SERVER space. The following code can be used in 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) Example 1 master. sys. sysprocesses where spid in (select blocked from master. sys. sysprocesses) spid process, STATUS, Logon account = SUBSTRING (SUSER_SNAME (sid),), user machine name = SUBSTRING (hostname ), locked = convert (char (3), blocked), database name = SUBSTRING (db_name (dbid),), cmd command, waittype as wait type, last_batch last batch processing time, number of uncommitted transactions in open_tran from master. sys. sysprocessesspid testbook bookid testBook