Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Query to track the throughput of SQL Server distribution databases
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
You can’t perform that action at this time.