SQL Server query performance optimization analysis transactions and locks (2)

Source: Internet
Author: User
Tags sql server query
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.