Deleting records does not reduce size of database

After deleting few records from database the size of database does not reduce. We are using neo4j community desktop edition version 3.1. We have also tried using copy-store utils (bash script) but the script is also giving errors.

Hello, you may want to review this article on understanding database growth.

A summary of the relevant details, deletion does not compact the store, it only marks existing records as deleted, which are then eligible for reuse later. In addition the ids of the deleted entries are stored in id files (so that we quickly know which entries are eligible for reuse). That takes up space as elements are deleted, so you may see some growth there. When data is added that ends up reusing that space, the id files shrink as those ids are reclaimed, and the store does not grow, so you may see the database size decrease some when this happens.

You may also want to pay attention to transaction logs that build up as database changes are committed. By default the last 7 days of logs are kept around, so this may be contributing the most to your graph size. You may want to review transaction log handling, as changing the retention configuration to something lower may end up pruning a good amount of logs that are taking up space. Note that you should never modify or delete transaction logs yourself, use the configuration properties instead.

Thanks Andrew,

My basic problem is, as database size is increasing the Neo4j database is hanging and the desktop application I am using is unusable. I have to restart Neo4j in order to work again. So I wanted to remove old data which is of no use and reduce the size of database and fix the issue of Neo4j hang. Currently the database size is 15 GB. IS there anything else I can do in order to fix the hang problem?

I'm not sure if you're looking at the right place for a solution for that kind of problem. The size of the db is rarely the direct cause of a hang. We'll need more information of what you're trying to do, including your query and the indexes/constraints you have on the graph.

If you want to clean the whole database you can just remove the data/databases/graph.db directory
and restart.

If you want to keep the data after your deletion but want to compact it, try my