Skip to content

Commit e7ca0a6

Browse files
Update sp_PressureDetector.sql
Make column names more clear for wait stats
1 parent f56b648 commit e7ca0a6

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

sp_PressureDetector/sp_PressureDetector.sql

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ BEGIN
9595
SELECT ' * wait stats relevant to cpu, memory, and disk pressure, along with query performance' UNION ALL
9696
SELECT ' * how many worker threads and how much memory you have available' UNION ALL
9797
SELECT ' * running queries that are using cpu and memory' UNION ALL
98-
SELECT 'from your loving sql server consultant, erik darling: https://erikdarling.com';
98+
SELECT 'from https://erikdarling.com';
9999

100100
/*
101101
Parameters
@@ -554,8 +554,8 @@ OPTION(MAXDOP 1, RECOMPILE);',
554554
(
555555
id bigint IDENTITY,
556556
collection_time datetime2(7) NOT NULL DEFAULT SYSDATETIME(),
557-
hours_uptime integer NULL,
558-
hours_cpu_time decimal(38,2) NULL,
557+
server_hours_uptime integer NULL,
558+
server_hours_cpu_time decimal(38,2) NULL,
559559
wait_type nvarchar(60) NOT NULL,
560560
description nvarchar(60) NULL,
561561
hours_wait_time decimal(38,2) NULL,
@@ -592,7 +592,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
592592
(
593593
id bigint IDENTITY,
594594
collection_time datetime2(7) NOT NULL DEFAULT SYSDATETIME(),
595-
hours_uptime integer NULL,
595+
server_hours_uptime integer NULL,
596596
drive nvarchar(255) NOT NULL,
597597
database_name nvarchar(128) NOT NULL,
598598
database_file_details nvarchar(1000) NULL,
@@ -1000,8 +1000,8 @@ OPTION(MAXDOP 1, RECOMPILE);',
10001000
DECLARE
10011001
@waits table
10021002
(
1003-
hours_uptime integer,
1004-
hours_cpu_time decimal(38,2),
1003+
server_hours_uptime integer,
1004+
server_hours_cpu_time decimal(38,2),
10051005
wait_type nvarchar(60),
10061006
description nvarchar(60),
10071007
hours_wait_time decimal(38,2),
@@ -1031,7 +1031,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
10311031
DECLARE
10321032
@file_metrics table
10331033
(
1034-
hours_uptime integer,
1034+
server_hours_uptime integer,
10351035
drive nvarchar(255),
10361036
database_name nvarchar(128),
10371037
database_file_details nvarchar(1000),
@@ -1159,8 +1159,8 @@ OPTION(MAXDOP 1, RECOMPILE);',
11591159
INSERT
11601160
@waits
11611161
(
1162-
hours_uptime,
1163-
hours_cpu_time,
1162+
server_hours_uptime,
1163+
server_hours_cpu_time,
11641164
wait_type,
11651165
description,
11661166
hours_wait_time,
@@ -1171,7 +1171,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
11711171
sorting
11721172
)
11731173
SELECT
1174-
hours_uptime =
1174+
server_hours_uptime =
11751175
(
11761176
SELECT
11771177
DATEDIFF
@@ -1182,7 +1182,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
11821182
)
11831183
FROM sys.dm_os_sys_info AS osi
11841184
),
1185-
hours_cpu_time =
1185+
server_hours_cpu_time =
11861186
(
11871187
SELECT
11881188
CONVERT
@@ -1414,8 +1414,8 @@ OPTION(MAXDOP 1, RECOMPILE);',
14141414
SELECT
14151415
w.wait_type,
14161416
w.description,
1417-
w.hours_uptime,
1418-
w.hours_cpu_time,
1417+
w.server_hours_uptime,
1418+
w.server_hours_cpu_time,
14191419
w.hours_wait_time,
14201420
w.avg_ms_per_wait,
14211421
w.percent_signal_waits,
@@ -1455,7 +1455,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
14551455
CONVERT
14561456
(
14571457
decimal(38,2),
1458-
(w2.hours_cpu_time - w.hours_cpu_time) / 1000.
1458+
(w2.server_hours_cpu_time - w.server_hours_cpu_time) / 1000.
14591459
),
14601460
wait_time_seconds =
14611461
CONVERT
@@ -1522,8 +1522,8 @@ OPTION(MAXDOP 1, RECOMPILE);',
15221522
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
15231523
INSERT INTO ' + @log_table_waits + N'
15241524
(
1525-
hours_uptime,
1526-
hours_cpu_time,
1525+
server_hours_uptime,
1526+
server_hours_cpu_time,
15271527
wait_type,
15281528
description,
15291529
hours_wait_time,
@@ -1532,8 +1532,8 @@ OPTION(MAXDOP 1, RECOMPILE);',
15321532
waiting_tasks_count
15331533
)
15341534
SELECT
1535-
w.hours_uptime,
1536-
w.hours_cpu_time,
1535+
w.server_hours_uptime,
1536+
w.server_hours_cpu_time,
15371537
w.wait_type,
15381538
w.description,
15391539
w.hours_wait_time,
@@ -1571,7 +1571,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
15711571
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
15721572
15731573
SELECT
1574-
hours_uptime =
1574+
server_hours_uptime =
15751575
(
15761576
SELECT
15771577
DATEDIFF
@@ -1760,7 +1760,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
17601760
INSERT
17611761
@file_metrics
17621762
(
1763-
hours_uptime,
1763+
server_hours_uptime,
17641764
drive,
17651765
database_name,
17661766
database_file_details,
@@ -1788,7 +1788,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
17881788
file_metrics AS
17891789
(
17901790
SELECT
1791-
fm.hours_uptime,
1791+
fm.server_hours_uptime,
17921792
fm.drive,
17931793
fm.database_name,
17941794
fm.database_file_details,
@@ -1840,7 +1840,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
18401840
fm.drive,
18411841
fm.database_name,
18421842
fm.database_file_details,
1843-
fm.hours_uptime,
1843+
fm.server_hours_uptime,
18441844
fm.file_size_gb,
18451845
fm.avg_read_stall_ms,
18461846
fm.avg_write_stall_ms,
@@ -1857,7 +1857,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
18571857
drive = N'Nothing to see here',
18581858
database_name = N'By default, only >100 ms latency is reported',
18591859
database_file_details = N'Use the @minimum_disk_latency_ms parameter to adjust what you see',
1860-
hours_uptime = 0,
1860+
server_hours_uptime = 0,
18611861
file_size_gb = 0,
18621862
avg_read_stall_ms = 0,
18631863
avg_write_stall_ms = 0,
@@ -2057,7 +2057,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
20572057
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
20582058
INSERT INTO ' + @log_table_file_metrics + N'
20592059
(
2060-
hours_uptime,
2060+
server_hours_uptime,
20612061
drive,
20622062
database_name,
20632063
database_file_details,
@@ -2074,7 +2074,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
20742074
io_stall_write_ms
20752075
)
20762076
SELECT
2077-
fm.hours_uptime,
2077+
fm.server_hours_uptime,
20782078
fm.drive,
20792079
fm.database_name,
20802080
fm.database_file_details,
@@ -2196,7 +2196,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
21962196
p AS
21972197
(
21982198
SELECT
2199-
hours_uptime =
2199+
server_hours_uptime =
22002200
(
22012201
SELECT
22022202
DATEDIFF
@@ -2230,7 +2230,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
22302230
p.object_name,
22312231
p.counter_name,
22322232
p.instance_name,
2233-
p.hours_uptime,
2233+
p.server_hours_uptime,
22342234
p.total,
22352235
p.total_per_second
22362236
FROM p

0 commit comments

Comments
 (0)