Created
October 17, 2017 19:33
-
-
Save databoffin/e153ce5bc8e3d222d7118c582a8aab68 to your computer and use it in GitHub Desktop.
Query to track the throughput of SQL Server distribution databases
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
USE distribution; | |
GO | |
--Track the throughput per minute | |
SELECT CONVERT(SMALLDATETIME, t.entry_time) AS EntryTime, | |
COUNT(1) AS Commands | |
FROM MSrepl_commands cmds | |
INNER JOIN MSarticles a ON a.article_id = cmds.article_id | |
INNER JOIN MSrepl_transactions t ON cmds.xact_seqno = t.xact_seqno | |
GROUP BY CONVERT(SMALLDATETIME, t.entry_time) | |
ORDER BY CONVERT(SMALLDATETIME, t.entry_time) DESC; | |
--Track the throughput per article, per minute | |
SELECT a.article, | |
CONVERT(SMALLDATETIME, t.entry_time) AS EntryTime, | |
COUNT(1) AS Commands | |
FROM MSrepl_commands cmds | |
INNER JOIN MSarticles a ON a.article_id = cmds.article_id | |
INNER JOIN MSrepl_transactions t ON cmds.xact_seqno = t.xact_seqno | |
--WHERE a.article = 'SuspectedTable' | |
GROUP BY a.article, CONVERT(SMALLDATETIME, t.entry_time) | |
HAVING COUNT(1) > 1000 | |
ORDER BY CONVERT(SMALLDATETIME, t.entry_time) DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment