Bottom Line: It is safe to prune old committed Neo4j transaction logs using Neo4jās configuration retention settings or the dbms.checkpoint() procedure.
Why Do Neo4j Transaction Logs Exist?
Neo4j graph database writes write-ahead transaction logs (neostore.transaction.db.0, neostore.transaction.db.1) inside data/databases/neo4j/transactions/.
- Primary Purpose: Transaction recovery, ACID compliance, and cluster synchronization across Causal Clustering nodes.
- Storage Growth: High-volume graph updates (node insertions, relationship updates) generate gigabytes of log files.
- Storage Impact: Retaining default transaction logs consumes 5 GB to 50 GB+.
What Happens If You Prune Old Neo4j Transaction Logs?
- System Safety: ā Safe to Prune. Old logs that have already been checkpointed to main store files are no longer needed for crash recovery.
- Automatic Retention: Configuring
dbms.tx_log.rotation.retention_policykeeps transaction logs bounded automatically. - Reclaimed Storage: Pruning old logs frees 5 GB to 50 GB+ of disk space.
How to Prune Neo4j Transaction Logs Safely
Method 1: Configure Retention Policy in neo4j.conf
Edit conf/neo4j.conf to prune logs older than 2 days or 10 GB:
# Retain logs for 2 days maximum
dbms.tx_log.rotation.retention_policy=2 days
# Or retain a maximum size of 10 GB
# dbms.tx_log.rotation.retention_policy=10 GB
Method 2: Trigger Checkpoint via Cypher Shell
CALL dbms.checkpoint();
Frequently Asked Questions (FAQ)
Can I manually delete active neostore.transaction.db files while Neo4j is running?
No. Deleting active transaction log files while the Neo4j service is running causes database store corruption and transaction failure.
Discussion
Loading authentication...