forked from MasayukiOzawa/SQLServer-Util
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
716e886
commit d02c22a
Showing
7 changed files
with
98 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,67 @@ | ||
SET NOCOUNT ON | ||
|
||
SELECT | ||
GETDATE() as counter_date, | ||
counter_name, | ||
[Average wait time (ms)], | ||
[Waits in progress], | ||
[Waits started per second], | ||
[Cumulative wait time (ms) per second] | ||
FROM | ||
( | ||
IF (SERVERPROPERTY('ProductMajorVersion') IS NOT NULL) | ||
BEGIN | ||
SELECT | ||
RTRIM(instance_name) AS instance_name, | ||
RTRIM(counter_name) AS counter_name, | ||
cntr_value | ||
FROM | ||
sys.dm_os_performance_counters | ||
WHERE | ||
object_name like '%Wait Statistics%' | ||
) AS T | ||
PIVOT | ||
( | ||
SUM(cntr_value) | ||
FOR instance_name | ||
IN( | ||
GETDATE() as counter_date, | ||
counter_name, | ||
[Average wait time (ms)], | ||
[Waits in progress], | ||
[Waits started per second], | ||
[Cumulative wait time (ms) per second] | ||
) | ||
) AS PVT | ||
ORDER BY counter_name | ||
FROM | ||
( | ||
SELECT | ||
RTRIM(instance_name) AS instance_name, | ||
RTRIM(counter_name) AS counter_name, | ||
cntr_value | ||
FROM | ||
sys.dm_os_performance_counters | ||
WHERE | ||
object_name like '%Wait Statistics%' | ||
) AS T | ||
PIVOT | ||
( | ||
SUM(cntr_value) | ||
FOR instance_name | ||
IN( | ||
[Average wait time (ms)], | ||
[Waits in progress], | ||
[Waits started per second], | ||
[Cumulative wait time (ms) per second] | ||
) | ||
) AS PVT | ||
ORDER BY counter_name | ||
END | ||
ELSE | ||
BEGIN | ||
SELECT | ||
GETDATE() as counter_date, | ||
counter_name, | ||
[平均待機時間 (ミリ秒)] AS [Average wait time (ms)], | ||
[待機中] AS [Waits in progress], | ||
[1 秒あたりに開始された待機回数] AS [Waits started per second], | ||
[1 秒あたりの累積待機時間 (ミリ秒)] AS [Cumulative wait time (ms) per second] | ||
FROM | ||
( | ||
SELECT | ||
RTRIM(instance_name) AS instance_name, | ||
RTRIM(counter_name) AS counter_name, | ||
cntr_value | ||
FROM | ||
sys.dm_os_performance_counters | ||
WHERE | ||
object_name like '%Wait Statistics%' | ||
) AS T | ||
PIVOT | ||
( | ||
SUM(cntr_value) | ||
FOR instance_name | ||
IN( | ||
[平均待機時間 (ミリ秒)], | ||
[待機中], | ||
[1 秒あたりに開始された待機回数], | ||
[1 秒あたりの累積待機時間 (ミリ秒)] | ||
) | ||
) AS PVT | ||
ORDER BY counter_name | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters