Home Database Mysql Tutorial SQLSERVER2012里的扩展事件初尝试(下)

SQLSERVER2012里的扩展事件初尝试(下)

Jun 07, 2016 pm 05:37 PM
event try Expand

SQLSERVER2012里的扩展事件初尝试(下) SQLSERVER2012里的扩展事件初尝试(上) 我们继续文章扩展事件在Denali CTP3里的新UI(二)里的这个实验 脚本文件下载: 我们打开上篇创建的blogtest扩展事件会话的属性 检查一下sql_statement_starting事件和sql_sta

SQLSERVER2012里的扩展事件初尝试(下)

SQLSERVER2012里的扩展事件初尝试(上)

我们继续文章扩展事件在Denali CTP3里的新UI(二)里的这个实验

脚本文件下载:

我们打开上篇创建的blogtest扩展事件会话的属性

检查一下sql_statement_starting事件和sql_statement_completed事件的谓词是不是database_name=’Northwind’

 

运行workload

大家可以看到instnwnd.sql这个文件是比较大的,执行的时候会产生一些workload

 

我们启动blogtest会话

然后执行instnwnd.sql脚本

如果你的机器运行这个脚本很长时间,你可以点击工具栏的“停止数据反馈”,SSMS会停止继续显示实时数据

实时数据窗口可能只有两个列name和timestamp,这是仅有的2个所有扩展事件共有的列

你可以选择工具栏上的选择列按钮,添加/删除需要显示的列

我增加了3个列database_name,duration和statement

 

我们要找到Northwind数据库里平均执行时间最长的query,首先我们可以过滤不必要的事件

上篇曾提到过谓词可以在SQL Server端避免不需要的事件被产生,我们同时也支持客户端的过滤器,这可以帮助你做各种分析

点击工具栏上的筛选器按钮,这将打开筛选器对话框

这里我们设置两个条件name=sql_statement_completed And database_name=Northwind

为了避免输入错误,你可以从事件列表里拷贝粘帖,你还可以右键点击某个单元格,然后选择Filter by this Value,

这将自动为你添加一个子句并And到原有条件上

设置完毕之后点击确定

过滤掉不必要的事件后我们按照statement来做分组,点击工具栏上的分组按钮

把statement移动到右边,点击确定

分组的目的是为了计算每个分组上duration的平均值,下面可以点击工具栏上的聚合按钮

我们在duration上聚合类型选择AVG

然后选择在duration(AVG)上按降序排序

这样duration平均值最大的分组将被显示在第一行

我执行instnwnd.sql的workload里duration最大的分组是“exec master.dbo.sp_MSdbuserpriv N'serv'”

它的duration是13610微秒,这样我们就找到了平均开销最大的query

我们用单位换算器换算一下

 

你可以通过 打开-》合并扩展事件文件-》来打开生成的xel文件

总结

大家一定会好奇,为什麽在创建事件会话的时候会有筛选器,在SSMS工具栏又有筛选器

其实扩展事件是属于SQLSERVER端的,,把SQLSERVER profiler的功能搬到SQLSERVER端,当然不是简单的搬到SQLSERVER端

而SSMS的工具栏只是提供一些分析xel文件的工具,这些跟SQLSERVER profiler是差不多的

比如人家给你一个xel文件,你需要SSMS的扩展事件工具栏的工具去分析

 

而以前SQLSERVER profiler是属于客户端的(是一个客户端工具),profiler获取SQLSERVER端的各种事件,然后传送回客户端,

在SQLSERVER profiler界面上显示给大家

 

所以大家可以理解为扩展事件就是把SQLSERVER profiler的功能集成到SQLSERVER端,反正我是这样理解的,不过这个集成不是简单的集成

 

如有不对的地方,欢迎大家拍砖o(∩_∩)o

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

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)

From start to finish: How to use php extension cURL to make HTTP requests From start to finish: How to use php extension cURL to make HTTP requests Jul 29, 2023 pm 05:07 PM

From start to finish: How to use php extension cURL for HTTP requests Introduction: In web development, it is often necessary to communicate with third-party APIs or other remote servers. Using cURL to make HTTP requests is a common and powerful way. This article will introduce how to use PHP to extend cURL to perform HTTP requests, and provide some practical code examples. 1. Preparation First, make sure that php has the cURL extension installed. You can execute php-m|grepcurl on the command line to check

Extensions and third-party modules for PHP functions Extensions and third-party modules for PHP functions Apr 13, 2024 pm 02:12 PM

To extend PHP function functionality, you can use extensions and third-party modules. Extensions provide additional functions and classes that can be installed and enabled through the pecl package manager. Third-party modules provide specific functionality and can be installed through the Composer package manager. Practical examples include using extensions to parse complex JSON data and using modules to validate data.

How to install mbstring extension under CENTOS7? How to install mbstring extension under CENTOS7? Jan 06, 2024 pm 09:59 PM

1.UncaughtError:Calltoundefinedfunctionmb_strlen(); When the above error occurs, it means that we have not installed the mbstring extension; 2. Enter the PHP installation directory cd/temp001/php-7.1.0/ext/mbstring 3. Start phpize(/usr/local/bin /phpize or /usr/local/php7-abel001/bin/phpize) command to install php extension 4../configure--with-php-config=/usr/local/php7-abel

Get upcoming calendar events on your iPhone lock screen Get upcoming calendar events on your iPhone lock screen Dec 01, 2023 pm 02:21 PM

On iPhones running iOS 16 or later, you can display upcoming calendar events directly on the lock screen. Read on to find out how it's done. Thanks to watch face complications, many Apple Watch users are used to being able to glance at their wrist to see the next upcoming calendar event. With the advent of iOS16 and lock screen widgets, you can view the same calendar event information directly on your iPhone without even unlocking the device. The Calendar Lock Screen widget comes in two flavors, allowing you to track the time of the next upcoming event, or use a larger widget that displays event names and their times. To start adding widgets, unlock your iPhone using Face ID or Touch ID, press and hold

Outlook insists on trying to connect [Fix] Outlook insists on trying to connect [Fix] Mar 13, 2024 am 09:22 AM

This article will explore the steps you can take to resolve situations where Outlook is stuck while trying to connect. No matter what version of Microsoft Office, including Microsoft 365, you may encounter this problem. This issue causes the Outlook desktop application to be unable to receive emails properly, so it becomes crucial to resolve this issue. Fix Outlook Hangs on Trying to Connect If Outlook is having trouble connecting and you find that you're not receiving new mail on the desktop app, the following suggestions may be able to help resolve the issue. Before trying these methods, check to see if your internet connection is working properly. Try restarting your router sometimes

How to use the Aurora Push extension to implement batch message push function in PHP applications How to use the Aurora Push extension to implement batch message push function in PHP applications Jul 25, 2023 pm 08:07 PM

How to use the Aurora Push extension to implement batch message push function in PHP applications. In the development of mobile applications, message push is a very important function. Jiguang Push is a commonly used message push service that provides rich functions and interfaces. This article will introduce how to use the Aurora Push extension to implement batch message push functionality in PHP applications. Step 1: Register a Jiguang Push account and obtain an API key. First, we need to register on the Jiguang Push official website (https://www.jiguang.cn/push)

In JavaScript, what is the purpose of the 'oninput' event? In JavaScript, what is the purpose of the 'oninput' event? Aug 26, 2023 pm 03:17 PM

When a value is added to the input box, the oninput event occurs. You can try running the following code to understand how to implement oninput events in JavaScript - Example<!DOCTYPEhtml><html> <body> <p>Writebelow:</p> <inputtype="text&quot

How to implement calendar functions and event reminders in PHP projects? How to implement calendar functions and event reminders in PHP projects? Nov 02, 2023 pm 12:48 PM

How to implement calendar functions and event reminders in PHP projects? Calendar functionality and event reminders are one of the common requirements when developing web applications. Whether it is personal schedule management, team collaboration, or online event scheduling, the calendar function can provide convenient time management and transaction arrangement. Implementing calendar functions and event reminders in PHP projects can be completed through the following steps. Database design First, you need to design a database table to store information about calendar events. A simple design could contain the following fields: id: unique to the event

See all articles