Contact us
Insights

Sizing transaction logs

A log that keeps growing can fill the disk and stop the database. How to size transaction logs for your heaviest real work.

The problem

The log that filled the disk

Every change to a SQL Server database is written to its transaction log first. If the log fills and can’t grow, the database stops accepting changes. Logs grow when a large transaction runs, when log backups aren’t happening, or when something prevents the space being reused, such as a long-open transaction or a replica that’s fallen behind. Growing in small steps also slows the log down over time.

What drives log size

What decides how big a log needs to be

Recovery model

In full recovery, log space is only reused after a log backup. In simple, after each checkpoint.

Log backup frequency

More frequent log backups mean less log held between them.

Largest transaction

An index rebuild or big batch update must fit in the log in one go.

Anything holding the log

Long-open transactions, replication, and availability group replicas.

Sizing

How to size a log

Step 1 of 4

  1. Track log space used over a month, including index maintenance and month end.

  2. Set the log comfortably above the peak, created in one step rather than many small growths.

  3. A fixed size, not a percentage, as a safety net, not the plan.

  4. Alert when the log passes an agreed percentage full, with the reason it can’t be reused.

Don’t shrink it on a schedule

Shrinking a log that will only grow again the same night wastes effort and fragments it. Shrink once, after fixing the cause of unusual growth, then resize it properly. For example: a log that grew to 200GB because log backups failed for a week can be shrunk and resized once the backups are running again.

Transaction logs growing out of control?

Tell us which databases are affected and how they’re backed up. A few lines are enough.

Tell us what’s not working