Home Database Mysql Tutorial SQL SERVER 查询性能优化分析事务与锁(一)

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

Jun 07, 2016 pm 05:44 PM
server affairs optimization analyze performance Inquire

一、使用工具观察与分析数据库中锁信息 此现象类似高速公路上有大量的车辆进入,而在收费口却只开了一个、二个。造成收费口的车辆拥堵,而后方却又有大量的车辆涌入,这时所有的车辆都会慢下来,驾驶员彼此再减速刹车互相等待,最后导致后方的车子会被迫停下

一、使用工具观察与分析数据库中锁信息

      此现象类似高速公路上有大量的车辆进入,而在收费口却只开了一个、二个。造成收费口的车辆拥堵,而后方却又有大量的车辆涌入,这时所有的车辆都会慢下来,驾驶员彼此再减速刹车互相等待,最后导致后方的车子会被迫停下来,形成高速公路停车场。(就如第一次节假日高速公路免费通行那天,即2012年国庆高速公路大堵车的情形,高速公路成停车场)

      如果数据库中在设计时,设计不当,设计有过热数据表时,也就是所有应用程序的访问行为都跟某张数据表有关,香港空间,美国服务器,甚至集中访问某些字段,这就像前述例子中的所有车辆都在同一地点(高速公路收费口)驶上高速公路。这时耗时与快速的两种访问行为混合在一起,就像大货车与小轿车一起争车道,很容易发生彼此锁定,形成死锁而动弹不得的情况。

第一步,使用SQL SERVER提供图形界面工具观察哪些进程被加锁

 

                                                                             图1

 

 

2) SQL SERVER 2005 的Microsoft SQL Server Management Studio提供图形界面工具中的信息不会自动更新。刷新“活动监视器”界面中的内容,需要手动使用鼠标点击上方工具栏上的“刷新”按钮。如下图2,是未点击“刷新”按钮之前的显示的内容,图3,是点击“刷新”按钮之后的,显示的内容。

        图2

        图3

 

2) SQL SERVER 2005中可以通过下图中的设置,美国服务器,设置成自动更新的时间周期。如下图4。

 

 

                               图4

 

 

按对象分类的锁”两个标记进行观察。

活动监视器--按进程分类的锁

如下图5。

 

                                               图5

活动监视器--按对象分类的锁

如下图6。

 

                                                图6

 

接下来说一下SQL SERVER 2008中的活动监视器的使用:

1) SQL SERVER 2008活动监视器就不在管理中了。一、点击工具栏上的图标。二、使用右键点击数据库服务器,如下图7。然后都会出现如图8的图形界面工具。

 

 

                图7

 

                       图8

 

,然后选择活动监视器获取新的实例信息所用的间隔。

 

 

          图9

 

 

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Performance comparison of different Java frameworks Performance comparison of different Java frameworks Jun 05, 2024 pm 07:14 PM

Performance comparison of different Java frameworks: REST API request processing: Vert.x is the best, with a request rate of 2 times SpringBoot and 3 times Dropwizard. Database query: SpringBoot's HibernateORM is better than Vert.x and Dropwizard's ORM. Caching operations: Vert.x's Hazelcast client is superior to SpringBoot and Dropwizard's caching mechanisms. Suitable framework: Choose according to application requirements. Vert.x is suitable for high-performance web services, SpringBoot is suitable for data-intensive applications, and Dropwizard is suitable for microservice architecture.

PHP array key value flipping: Comparative performance analysis of different methods PHP array key value flipping: Comparative performance analysis of different methods May 03, 2024 pm 09:03 PM

The performance comparison of PHP array key value flipping methods shows that the array_flip() function performs better than the for loop in large arrays (more than 1 million elements) and takes less time. The for loop method of manually flipping key values ​​takes a relatively long time.

C++ program optimization: time complexity reduction techniques C++ program optimization: time complexity reduction techniques Jun 01, 2024 am 11:19 AM

Time complexity measures the execution time of an algorithm relative to the size of the input. Tips for reducing the time complexity of C++ programs include: choosing appropriate containers (such as vector, list) to optimize data storage and management. Utilize efficient algorithms such as quick sort to reduce computation time. Eliminate multiple operations to reduce double counting. Use conditional branches to avoid unnecessary calculations. Optimize linear search by using faster algorithms such as binary search.

How to optimize the performance of multi-threaded programs in C++? How to optimize the performance of multi-threaded programs in C++? Jun 05, 2024 pm 02:04 PM

Effective techniques for optimizing C++ multi-threaded performance include limiting the number of threads to avoid resource contention. Use lightweight mutex locks to reduce contention. Optimize the scope of the lock and minimize the waiting time. Use lock-free data structures to improve concurrency. Avoid busy waiting and notify threads of resource availability through events.

What is the performance impact of converting PHP arrays to objects? What is the performance impact of converting PHP arrays to objects? Apr 30, 2024 am 08:39 AM

In PHP, the conversion of arrays to objects will have an impact on performance, mainly affected by factors such as array size, complexity, object class, etc. To optimize performance, consider using custom iterators, avoiding unnecessary conversions, batch converting arrays, and other techniques.

Performance comparison of Java frameworks Performance comparison of Java frameworks Jun 04, 2024 pm 03:56 PM

According to benchmarks, for small, high-performance applications, Quarkus (fast startup, low memory) or Micronaut (TechEmpower excellent) are ideal choices. SpringBoot is suitable for large, full-stack applications, but has slightly slower startup times and memory usage.

Performance comparison of C++ with other languages Performance comparison of C++ with other languages Jun 01, 2024 pm 10:04 PM

When developing high-performance applications, C++ outperforms other languages, especially in micro-benchmarks. In macro benchmarks, the convenience and optimization mechanisms of other languages ​​such as Java and C# may perform better. In practical cases, C++ performs well in image processing, numerical calculations and game development, and its direct control of memory management and hardware access brings obvious performance advantages.

The impact of inline functions on performance: a deeper look The impact of inline functions on performance: a deeper look Apr 28, 2024 pm 05:39 PM

Inline functions improve local execution speed by eliminating function call overhead, reducing the need for stack space and improving branch prediction, but excessive use may lead to code bloat and non-local effects.

See all articles