Skip to content

Commit b8339b8

Browse files
Update sp_PressureDetector.sql
switch the cast to convert, add in the DB_ID to make sqldb a little more sqldbier.
1 parent c920463 commit b8339b8

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

sp_PressureDetector/sp_PressureDetector.sql

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,8 +1669,12 @@ OPTION(MAXDOP 1, RECOMPILE);',
16691669
ISNULL
16701670
(
16711671
vfs.io_stall_read_ms /
1672-
CAST((NULLIF(vfs.num_of_reads, 0)) AS decimal(38, 2)),
1673-
0
1672+
CONVERT
1673+
(
1674+
decimal(38, 2),
1675+
NULLIF(vfs.num_of_reads, 0.)
1676+
),
1677+
0.
16741678
)
16751679
),
16761680
total_gb_written =
@@ -1702,15 +1706,29 @@ OPTION(MAXDOP 1, RECOMPILE);',
17021706
ISNULL
17031707
(
17041708
vfs.io_stall_write_ms /
1705-
CAST((NULLIF(vfs.num_of_writes, 0)) AS decimal(38, 2)),
1706-
0
1709+
CONVERT
1710+
(
1711+
decimal(38, 2),
1712+
NULLIF(vfs.num_of_writes, 0.)
1713+
),
1714+
0.
17071715
)
17081716
),
17091717
io_stall_read_ms,
17101718
io_stall_write_ms,
17111719
sample_time =
17121720
SYSDATETIME()
1713-
FROM sys.dm_io_virtual_file_stats(NULL, NULL) AS vfs
1721+
FROM sys.dm_io_virtual_file_stats
1722+
(' +
1723+
CASE
1724+
WHEN @azure = 1
1725+
THEN N'
1726+
DB_ID()'
1727+
ELSE N'
1728+
NULL'
1729+
END + N',
1730+
NULL
1731+
) AS vfs
17141732
JOIN ' +
17151733
CONVERT
17161734
(

0 commit comments

Comments
 (0)