Dealing with the ridiculous amount of PostgreSQL space used by N8N.


N8N's database capacity was great.

I usually use n8n to connect and automate various tasks.
previously written article

The other day I upgraded to a major version, so I looked at the data capacity before updating, and it was a surprise '64GByte' ...

It's just too big.
Because it had become a capacity that I did not even feel like backing up, I investigated how to make the data smaller.

Configuration of N8N log data deletion from oldest to newest.

Since it is PostgreSQL, I thought I could just 'VACUUM' it, but it seems there was some setting in the configuration that would delete the old data. A similar question was raised on this forum.

It seems that by setting the following environment variable, the old logs are deleted at startup.

1// Activates automatic data pruning
3// Number of hours after execution when they should be deleted, by default 14 days

The default for "EXECUTIONS_DATA_MAX_AGE" is 14 days, but "EXECUTIONS_DATA_PRUNE" is not true by default...
I would have been happy if it was true by default.

VACUUM is required for SQLite

If you are using SQLite, it seems that you cannot delete data by setting environment variables.

It seems that you will have to use the method described in this forum to perform VACUUM.


I set EXECUTIONS_DATA_MAX_AGE to 60 and restarted, but it doesn't start at all, as if there is too much data...
The logs are flowing, so it seems to be taking a long time to process them.

And, there seems to be a point to check various things to set N8N to v1.0.
I have a bad feeling about something, so I'm going to operate it as it is for a while longer, and when I have more time, I'll try to make it v1.0.