SQL Server Replication Latency

Review transactional replication tracer history with agent state. Use moon to continuously track changes in delivery latency.

2026-09-16 · 2 min read

Why this problem matters

Transactional replication latency can indicate that the distributor or subscriber cannot process changes at the production rate. Backlog and end-to-end delivery time may grow even while an agent appears to be running.

How to diagnose it

When tracer-token results exist, inspect publisher-to-distributor and distributor-to-subscriber times separately. Without that data, evaluate agent history, distributor backlog, and network or subscriber resources together.

The query reads existing tracer-token records from the distribution database and creates no new token. Adapt it if the distribution database has another name; no rows do not prove zero replication latency.

SELECT TOP (50)
       publication_id,
       publisher_commit,
       distributor_commit,
       subscriber_commit,
       DATEDIFF_BIG(millisecond, publisher_commit, distributor_commit) AS publisher_to_distributor_ms,
       DATEDIFF_BIG(millisecond, distributor_commit, subscriber_commit) AS distributor_to_subscriber_ms
FROM distribution.dbo.MStracer_tokens
WHERE publisher_commit IS NOT NULL
ORDER BY publisher_commit DESC;

A safe solution approach

After identifying the slow segment, investigate agent profile, distributor capacity, subscriber queries, and network issues in a targeted way. Reinitializing a subscription should not be the default response without understanding data volume and outage impact.

Why continuous monitoring matters

Latency can grow rapidly during write-heavy periods and disappear before a manual check. moon can monitor relevant SQL Server signals and route persistent-delay alerts through Slack, PagerDuty, or webhooks.

Frequently asked questions

Does a running agent prove there is no latency? Does a tracer token modify application data?

No, a running agent may still deliver accumulated commands more slowly than they are produced. A tracer token is a diagnostic marker, but its use and frequency should follow the environment's operational policy.

How does moon help with this problem?

moon continuously observes SQL Server, PostgreSQL, and MongoDB signals, helping teams evaluate the problem as a trend instead of relying on a one-time check.