Tips > Reliability & Performance

Prune Execution Data to Prevent Database Bloat

Every workflow execution stores its full input/output data in the database by default.

Every workflow execution stores its full input/output data in the database by default. After a few weeks of active use, the executions table can grow to tens of gigabytes, slowing down the entire n8n interface and eventually filling your disk.

Real-world example: A production n8n instance running 200 workflows became unusably slow after 3 months. Investigation revealed 2.8 million execution records consuming 47 GB of database storage.


# .env configuration for execution pruning

# Enable automatic pruning

EXECUTIONS_DATA_PRUNE=true

# Keep successful executions for 7 days

EXECUTIONS_DATA_MAX_AGE=168

# Keep only the last 5000 executions regardless of age

EXECUTIONS_DATA_PRUNE_MAX_COUNT=5000

# Prune check interval in minutes (default: 15)

EXECUTIONS_DATA_PRUNE_TIMEOUT=15
```text
For high-volume deployments, combine pruning with selective saving:

```bash

# Don't save data for successful executions at all

EXECUTIONS_DATA_SAVE_ON_SUCCESS=none

# Always save data for failed executions (for debugging)

EXECUTIONS_DATA_SAVE_ON_ERROR=all

# Save manual executions (useful for development)

EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true
```text
| Scenario | Recommended Settings |
|:---------|:--------------------|
| Development | Save all, prune after 30 days |
| Production (low volume) | Save all, prune after 7 days, max 10k |
| Production (high volume) | Save failures only, prune after 3 days |
| Compliance-required | Save all, prune after retention period, use external log export |

**Related:** [Flatten Deeply Nested API Responses](../code-node-mastery/01-flatten-deeply-nested-api-responses.md) | [Use Docker Compose with Health Checks for n8n and PostgreSQL](../self-hosting-operations/01-use-docker-compose-with-health-checks-for-n8n-and-postgresql.md)

Showcase builds

19 complete workflows from my own projects, each with its n8n workflow JSON to import. Showcase entries link the file at the end of the article.

See the showcase builds

Keep reading

191 entries grouped by topic, from first workflow to queue mode. Free, no signup.

Browse the encyclopedia

Need it built?

I design, build and run n8n systems for clients. Every engagement starts with a $1,500 diagnostic audit, credited toward the build.

Book a 20-minute call