Invoice Ledger

Stop n8n filling your disk: execution history, pruning, SQLite vs Postgres

Execution data is the quiet growth in every self-hosted instance. Here are the documented defaults, the settings that change them, and the check that proves they worked.

Guide · defaults quoted from n8n documentation on 22 October 2026 · works with JavaScript switched off

Why the disk grows when nothing is happening

n8n saves the data of every execution: which nodes ran, what each one returned, and — if your workflow reads a PDF — the extracted text. n8n's own documentation opens its execution-data page with the problem in plain words: depending on your settings and volume, the database can grow and run out of storage.1

So the growth is a default, not a bug. The defaults are also documented, which means this is one of the few self-hosting problems you can solve by reading rather than experimenting.

1. Know the defaults before you change them

VariableDefaultWhat it does
EXECUTIONS_DATA_PRUNEtrueDelete old executions on a rolling basis — already on
EXECUTIONS_DATA_MAX_AGE336Hours before an execution is eligible for deletion (14 days)
EXECUTIONS_DATA_PRUNE_MAX_COUNT10000Rows kept; 0 means no limit
EXECUTIONS_DATA_SAVE_ON_SUCCESSallSet to none and successful runs stop being stored
EXECUTIONS_DATA_SAVE_ON_ERRORallKeep errors — this is the one you want to see
EXECUTIONS_DATA_SAVE_ON_PROGRESSfalsePer-node progress; false cuts the volume per execution
EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONStrueManual test runs are stored too
EXECUTIONS_DATA_HARD_DELETE_BUFFER1Hours a finished execution must be old before hard delete
EXECUTIONS_DATA_PRUNE_HARD_DELETE_INTERVAL15Minutes between hard-delete passes
EXECUTIONS_DATA_PRUNE_SOFT_DELETE_INTERVAL60Minutes between soft-delete passes
N8N_EXECUTION_DATA_STORAGE_MODEdatabasefilesystem, s3, azure also exist

All of these are documented on n8n's Executions environment variables page; the pruning behaviour itself is on the Manage execution data page.12

2. Measure before you tune

Two numbers, one minute. The first is the data directory inside the container — the .n8n folder, which holds the SQLite database and the encryption key:

docker compose exec n8n du -sh /home/node/.n8n
docker compose exec n8n ls -lh /home/node/.n8n

The second is how many executions exist. With PostgreSQL:

docker compose exec -T postgres psql -U n8n -d n8n -c '\dt'

That lists the tables — including the one holding executions, which is named execution_entity in the n8n source tree this guide was written against.5 Confirm the name in your own output rather than trusting mine, then count:

docker compose exec -T postgres psql -U n8n -d n8n \
  -c 'select count(*) from execution_entity;'

With SQLite the database is a file in that folder; the count needs the sqlite3 binary, which the n8n image may not include. The directory size is then the honest measure.

Remember these two numbers. Without them, "I changed a setting" has no observable consequence.

3. Set the two numbers you actually chose

For a homelab instance, the interesting choice is usually the age. Thirty days of a small workflow's history is cheap; thirty days of a workflow that extracts a 40-page PDF four times a day is not. Decide with the directory size in front of you, not from a blog's table.

services:
  n8n:
    environment:
      EXECUTIONS_DATA_PRUNE: "true"
      EXECUTIONS_DATA_MAX_AGE: "168"          # 7 days
      EXECUTIONS_DATA_PRUNE_MAX_COUNT: "5000"
      EXECUTIONS_DATA_SAVE_ON_PROGRESS: "false"
      EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS: "false"

Then recreate the container and read the values back from inside it. An environment: block that the running container never received is the most common version of this mistake:

docker compose up -d n8n
docker compose exec n8n printenv EXECUTIONS_DATA_MAX_AGE EXECUTIONS_DATA_PRUNE_MAX_COUNT

4. Why the space does not come back immediately

Pruning is two passes, and the documentation says why: for performance, n8n first marks targets for deletion, then later removes them permanently.2 Three details follow from that, and each one has surprised someone:

5. Filesystem storage: moving the growth, not removing it

If the database itself is what you want to keep small, n8n can write execution data outside it: N8N_EXECUTION_DATA_STORAGE_MODE=filesystem, with the base path in N8N_STORAGE_PATH (default N8N_USER_FOLDER/storage). The s3 and azure modes require a self-hosted Business or Enterprise plan.1

This keeps queries fast and backups of the database small. It does not make the data disappear: the same pruning rules still decide how long it lives, and your backup now has two things to include instead of one. Do this if you have a reason; do not do it because it sounds tidier.

6. SQLite or PostgreSQL — the honest boundary

Fresh self-hosted installs use SQLite; the documentation describes PostgreSQL as the option you configure through environment variables.3 SQLite is a file: one writer, no network, nothing to administer, and it is entirely adequate for one person's workflows.

PostgreSQL starts to matter when several things write at once — queue mode, several workers, or a second user clicking while a schedule fires. The documentation's own framing is that SQLite is fine to try and Postgres is what you use for a production instance handling more than a handful of users or workflows running around the clock.4

Migrating is not a toggle. There is no supported button that turns a SQLite instance into a Postgres one; you export, point the instance at the new database, and import. That is a separate afternoon, and this guide does not pretend otherwise. If you are starting fresh and expect to grow, start on Postgres — the Compose file in the hardware guide does exactly that.

7. Prove it happened

Come back after the intervals above have passed — an hour is enough to see soft deletes, a day to see the shape — and take the same two measurements:

docker compose exec -T postgres psql -U n8n -d n8n \
  -c 'select count(*) from execution_entity;'
docker compose exec n8n du -sh /home/node/.n8n

What a pass looks like:

If the count did not move, the setting did not reach the process, or every row you have is annotated. Both are worth knowing, and both are visible in one command.

Troubleshooting

Honest limits

If the workflow filling your disk reads invoices

The pack this site sells runs eleven workflows on your own instance, parses invoices without an AI model, and writes one CSV ledger. Its nightly template keeps a dated copy of that ledger, which is the part execution pruning does not cover.

Invoice Ledger — 11 workflows, USD 49 · how the pipeline works · listed on the n8n template library

Sources

  1. n8n docs — Executions environment variables (defaults for EXECUTIONS_DATA_MAX_AGE 336, EXECUTIONS_DATA_PRUNE_MAX_COUNT 10,000, save-on-* flags, hard-delete buffer and intervals, storage modes; s3/azure need Business or Enterprise). Read 2026-10-22.
  2. n8n docs — Manage execution data (soft delete then hard delete; age or count; running/waiting rows and annotated executions never pruned). Read 2026-10-22.
  3. n8n docs — Choose n8n's database. Read 2026-10-22.
  4. n8n docs — Install using Docker Compose (SQLite by default; Postgres “for a production instance that must handle more than a handful of users or workflows running around the clock”). Read 2026-10-22.
  5. n8n repository — generated Postgres schema, public.execution_entity (the table name the count queries use, in the current source tree). Read 2026-10-22.

Version note: written against n8n 2.44.x (npm latest 2.44.5 on 2026-10-22) and PostgreSQL 18, the versions in n8n's own Compose example. Defaults change; the pages above win over this one.