Managing Disk Space Used by Transaction Logs
On this page
Calculating Disk Space Needed by Transaction Logs
Transaction logs require (snapshot_
* snapshots_
) of space over time (approximately), or about 4 GB per partition using the default values of these variables.
Each database partition has two preallocated transaction log files.log_
.
Moreover, when queries are submitted to the database transaction log files are filled.snapshot_
, which is 2GB by default.
Controlling Individual Log File Size
Individual log file size can be controlled by adjusting the log_
and log_
global engine variables.
These engine variables impact write throughput when there is a sustained burst of rowstore writes.
Reducing Disk Space Used by Transaction Logs
To reduce the total disk space occupied by all log files, tune the snapshot_
and snapshots_
global engine variables while keeping the following in mind.
-
A lower
snapshot_
value will result in more frequent snapshots, thereby reducing the accumulation of transaction logs.trigger_ size However, a higher setting will lead to fewer snapshots and result in a longer replay time for the snapshots taken. -
A large
snapshots_
value increases the number of snapshots available and therefore increases the amount of space needed to store snapshots.to_ keep
Managing Transaction Log Growth
To manage the growing size of your transaction logs, you can safely expand the disk size to accommodate new log files.
Deleting Transaction Logs
Warning
Transaction log files should never be deleted manually as doing so may result in the loss or corruption of your data.
To delete transaction logs, run SNAPSHOT on the database in which the logs are growing.
You can run the du
Linux command to determine which databases have the largest log files.
In the following situations, SNAPSHOT is run implicitly, in accordance with the value of the snapshots_
variable.
-
Transaction logs reach the size defined by the
snapshot_
variable and, as a result, a snapshot is triggered.trigger_ size -
The BACKUP command is run and, as a result, a snapshot is triggered.
-
Node maintenance operations occur (such as cluster upgrades) and, as a result, a snapshot is triggered.
The transaction logs may not get immediately cleaned out because the garbage collector (GC) has to do the final cleanup to complete the deletion process.
Last modified: March 8, 2024