Quick tip: Save disk space on Neo4j Desktop Databases

A trick I use with Neo4j Desktop databases to save local disk space is to configure Neo4j to store few or no transaction logs. All you have to do is add the following to your neo4j.conf file:

# Retention policy for transaction logs needed to perform recovery and backups.
dbms.tx_log.rotation.retention_policy=1 files

Normally what Neo4j does is to store all transaction logs. If you start out with a small database and then make a lot of changes to it, creating or deleting many nodes & edges, all of those cypher transactions get written into transaction log files. Sometimes, when I'm manipulating a database a lot, I end up in a situation where those log files are bigger than the database itself!

If you have a lot of databases this can add up. So I just add this configuration and tell the system to keep few or no transaction log files around.

This does come with a tradeoff. If your database crashes, the transaction logs are part of how the system can recover. And so if you don't keep them or they're not complete, you can have trouble recovering your database (which is why this setting is so conservative by default in Neo4j). As a result I wouldn't recommend this on any production system, and I generally use it with small testing databases that I could recreate if I needed, or where I have a backup anyway.

For more information on how and why this works, see:

1 Like