What’s Reading My Transaction Log?

I have a fairly heavy update workload in my database, and I have transactional replication enabled. When I’m monitoring disk activity I’ve noticed that there are a lot of reads, as well as writes, on the transaction log. Why is that?

This is a question we get asked a lot—why is something reading from my transaction log? Many times I’ve seen it stated that the transaction log is “write-only” or “write-mostly,” but that isn’t true. There are many processes and features that can cause reads of the transaction log, and transactional replication is one of them.


Transactional replication works by having a SQL Server Agent job periodically read the publication database’s transaction log on the Publisher to find committed changes to tables in the various publications you’ve defined. The changes are put into the distribution database on the Distributor for subsequent pushing or pulling to the subscription database(s) on the Subscriber(s). This process generates some of the read activity you’re seeing on your transaction log. (You can get a 200-level overview of transactional replication and other high-availability features in my MSDN white paper "High Availability with SQL Server 2008."


The most common cause of read activity on the transaction log is a backup operation. Transaction log backups (obviously) read all the transaction log records generated since the last transaction log backup completed. Full and differential backups must also read some transaction log records to guarantee that the restored database is transactionally consistent.


One feature that you might not expect to cause transaction log reads is a database snapshot (one you create manually or the one that’s created automatically when you run a DBCC CHECK* command). When a database snapshot is created, crash recovery is run on the database that the snapshot is based on, but the recovery is run into the database snapshot, making it a transactionally consistent, point-in-time view of the source database.


There are quite a few other things that can cause transaction log reads. See my recent blog post “ What can cause log reads and other transaction log questions” for more information.

Please or Register to post comments.

What's SQL Server Questions Answered?

Practical tips and answers to many of your questions about SQL Server including database management and performance issues.

Contributors

Paul S. Randal

Paul Randal worked on Microsoft's SQL Server team for nine years in development and management roles, writing many of the DBCC commands. Randal was ultimately responsible for SQL Server 2008'...

Kimberly L. Tripp

Kimberly L. Tripp has been working with SQL Server since 1990, and she’s worked as a consultant, trainer, speaker, and writer specializing in core SQL Server performance tuning and availability...
Blog Archive

Sponsored Introduction Continue on to (or wait seconds) ×