Ich "spiele" erst seit ca. 2 Wochen mit einem local installierten n8n auf einem alten Mac Mini. Die sqlite Datenbank im .n8n Verzeichnis mit den gespeicherten Executions ist schon 47 MB groß. Das könnte irgendwann zum Problem werden, vermute ich.
Deshalb habe ich auf https://docs.n8n.io über „Chat with the docs“ gefragt "how can i reduce the size of the sqlite database?" und erhielt diese Antwort: (Ist vielleicht auch für andere interessant)
To reduce the size of your SQLite database in n8n, you should:
- Enable Execution Data Pruning:Pruning deletes old execution data and binary data on a regular schedule. You can enable this by setting the following environment variables:EXECUTIONS_DATA_PRUNE=true EXECUTIONS_DATA_MAX_AGE=168 # Number of hours to keep data (e.g., 168 = 7 days) EXECUTIONS_DATA_PRUNE_MAX_COUNT=50000 # Max number of executions to keep This will ensure that old executions are regularly deleted, reducing database bloat. You can set these variables in your Docker Compose file or as environment variables in your deployment configuration.Enable executions pruning
- Run VACUUM on Startup:Even after pruning, SQLite does not automatically free up disk space. To reclaim disk space, enable the DB_SQLITE_VACUUM_ON_STARTUP environment variable:DB_SQLITE_VACUUM_ON_STARTUP=true This will run the SQLite VACUUM operation on startup, which rebuilds the database file and reduces its size.Database environment variables
- Manually Run VACUUM (if needed):If you want to manually reduce the file size, you can run:docker exec -u root YOUR_CONTAINER_ID sqlite3 /home/node/.n8n/database.sqlite "VACUUM;" This command will compact the database and free up unused space.Schedule Node Crashed SQL3/VPS - need help preventing total nuke
- Reduce Saved Execution Data:Configure n8n to save only necessary execution data. For example, you can choose not to save successful executions:EXECUTIONS_DATA_SAVE_ON_SUCCESS=none This will prevent unnecessary data from accumulating in your database.Execution dat
By combining these steps, you can effectively reduce and control the size of your SQLite database in n8n.