Why n8n execution data fills the database and when pruning is the fix
If your self-hosted n8n database keeps growing with execution records, execution pruning is the control that limits how much run data n8n retains. It decides how long finished executions stay in the database and how many are kept. Pruning does not by itself return disk space to the operating system, so the space recovery step is a separate decision covered later on this page. Each execution row records run status, timing and the node-level data n8n stores for that run. When your settings save full payloads for successful runs, a busy workflow adds a large volume of JSON to the database every day, and most of it is never read again.
Start by checking which executions you actually need. Failed runs are usually worth keeping longer because they support troubleshooting, while routine successful runs of high-frequency workflows rarely are. Saving fewer executions, or saving only error data for selected workflows, reduces growth at the source. Pruning more often is the right fix when retention is a business requirement and the volume is simply higher than the current settings assume. Confirm the exact retention and save options, and their defaults, in the n8n configuration reference for your release before you change anything, because names and behavior can differ between versions.
Keep three things separate. Execution pruning manages run history in the database, a database backup is a copy you restore from after failure, and binary file storage holds files that workflows process, which is a different data path with its own cleanup behavior. Pruning executions does not remove binary files, and deleting files does not shrink the execution history. Your backup policy should also account for the retention you choose, since backups capture whatever the database holds at the time. Compliance teams will ask how long execution data is kept, so record the retention decision alongside your database and backup documentation.
Pruning and saving settings, and when each one fits
This table compares the four controls a team can use to limit execution data: whether successful and failed runs are saved, how long data is kept, how many executions are kept, and per-workflow overrides. Read each row for when the control fits, what it puts at risk, and what to confirm in the n8n release you run, because setting names and defaults change between versions.
| Control | When it fits | Risk to weigh | What to confirm in your release |
|---|---|---|---|
| Save successful executions | High-volume workflows whose success path is fully logged elsewhere, such as in the target system | You lose the input and output trail that proves a routine run completed, which can matter for reconciliation or audit | Whether successful runs can be turned off globally, and whether the setting is environment-wide or per workflow |
| Save failed executions | Almost every production instance, because failures are the evidence needed for troubleshooting | Dropping failed runs removes the data needed to diagnose repeated errors and to show when a fault started | Whether failed runs are saved by default in your version and how long they stay visible in the executions list |
| Maximum age of retained data | Steady volume where a fixed retention window matches your incident and audit review cycle | Data older than the window is deleted on schedule, so reviews that look further back find nothing | The name and unit of the age setting, whether it applies to all executions, and when the pruning job runs |
| Maximum number of retained executions | Bursty workloads where row count, not age, drives database size | A busy period can push older but still relevant runs out of history before anyone reviews them | The count setting name, whether it is checked per workflow or across the instance, and how it interacts with the age setting |
| Per-workflow overrides | Mixed estates where a payments or HR workflow needs longer history than a noisy polling workflow | Overrides are easy to forget, so retention becomes inconsistent and hard to explain to an assessor | Whether overrides exist in your release, where they are set, and whether they can be listed or exported for review |
| Pruning and database reclaim | After any pruning change, to confirm the database actually shrinks on disk | Deleted rows may not return space to the operating system until the database is maintained, so disk alerts can persist | Whether your database engine (SQLite or PostgreSQL) needs a manual maintenance step, and who owns that step |
How an execution moves from saved run to pruned record
The path starts when a workflow run finishes. The save rules check whether the execution data is kept at all, and a per-workflow override can change that rule for a single workflow. Saved executions then wait for the pruning job, which removes records past the age or count limit you set. In PostgreSQL and SQLite, the deleted space becomes reusable pages inside the database file rather than returned to the disk, so check file size after pruning and plan a reclaim step if you need the space back.
Path of one execution record from the save decision through pruning to reclaimed space.
Setting up pruning on a production n8n instance
This sequence moves an n8n instance from unbounded execution storage to a documented retention policy, with overrides for high-volume or sensitive workflows and a size check that confirms the database is shrinking as planned.
Measure database size and execution volume
The platform or database owner records the current size of the n8n database and counts stored executions, grouped by workflow over a representative period. Start with the largest tables and the workflows that produce the most rows, so you know where growth comes from. Keep a dated copy of these figures as the baseline. The step is done when you can name the top few workflows by stored execution count and the total database size at that moment.
Agree retention needs with security and compliance owners
Before changing any setting, the workflow owners meet the security, compliance and privacy leads to decide which execution data must be kept, for how long, and which data must not be stored at all. Ask them to confirm the retention period their own policies or audit obligations require, and whether any workflow processes personal or regulated data that should not persist in execution history. Record the decisions in writing. The step is done when each class of workflow has a documented retention owner and a stated reason.
Set global save and pruning rules
The n8n administrator sets the instance-wide rules for which executions are saved, how long they are kept, and the maximum number retained, using the execution data settings in the instance configuration. Apply the change in a non-production environment first, using a copy of production data where possible, and confirm the setting names and defaults against the current n8n documentation for your version. The step is done when the non-production instance restarts cleanly and the configured values appear in its settings.
Add per-workflow overrides for exceptions
For workflows that are very high volume or handle sensitive data, the workflow owner applies a workflow-level save setting that differs from the global rule, such as saving fewer successful runs or none at all for sensitive inputs. Keep the number of overrides small and list each one with its owner and reason. Test a sample run of each overridden workflow in non-production to confirm what is stored. The step is done when a test execution is saved or skipped exactly as the documented override specifies.
Confirm the pruning job has run
After the new rules are active, the administrator checks the n8n logs and the execution list to confirm that pruning ran and removed executions older than the configured limit. Compare the oldest stored execution date and the record count against the expected retention window. If the oldest records are still outside the window after a full cycle, check the instance configuration and the database user permissions before going further. The step is done when the log entry or execution list shows the policy is being applied.
Verify with a test window and size check
Run the instance through a defined test window that covers normal business activity, then repeat the measurements from the first step. Compare record counts per workflow and total database size with the baseline. Confirm that workflows still produce the executions and audit trail the compliance owners asked for. Note that deleted rows in SQLite and PostgreSQL may not return disk space to the operating system until the database is compacted or vacuumed, so check file size separately from row counts. The step is done when the results are written into a report signed off by the owners.
Promote the policy and schedule reviews
Once the non-production results match the agreed retention rules, the administrator applies the same settings to production in a planned change window, with a rollback copy of the configuration and a recent backup. Repeat the record count and size check on production and store the results with the baseline. Ask the owners to review the retention policy whenever a new high-volume workflow is added or when the n8n version is upgraded, since setting names and behavior can change. The step is done when production shows the same pruning behavior as the test instance and the review date is recorded.
Reclaiming disk space after pruning in PostgreSQL versus SQLite
In PostgreSQL, pruning deletes rows from the execution tables, but the disk space those rows used is not automatically returned to the operating system. The database marks the space as dead and reuses it for later rows inside the same table files. That keeps the database healthy, but the files on disk can stay large after the row count drops. Shrinking them means rebuilding tables, which is a maintenance operation you schedule in advance.
- Reuse inside the database: Autovacuum reclaims dead rows so later executions can fill the same space. File system usage may stay flat even when the row count falls.
- File size on disk: The operating system files may not shrink on their own. Measure table and database sizes before deciding whether a rebuild is worth an outage.
- Planned downtime: A rebuild rewrites tables, so it needs a window in which n8n is stopped or cannot write new executions.
- Free disk headroom: Rewriting large tables can need temporary free space for new copies. Confirm the requirement for your PostgreSQL version and table sizes before you start.
- A tested restore point: Take a backup and confirm it restores into a test environment first. The continuous archiving documentation covers base backups and point-in-time recovery, which give you a way back if the rebuild fails.
Before scheduling the work, check current table sizes, confirm free space on the database volume and restore a recent backup into a test environment.
SQLite keeps the whole database in a single file, and how that file behaves after rows are deleted depends on the SQLite version and settings in use. Space freed by pruning often remains inside the file for reuse, so the file can stay large even when the execution count falls. Compacting it is a separate maintenance step. It normally requires the n8n instance to be stopped and a backup taken first, and the exact procedure should be confirmed against your n8n and SQLite versions.
- One volume to watch: The database file and any companion files sit on the same volume, so measure the whole data directory, not only the main file.
- Reuse before shrink: Freed space is normally reused for new data, so a large file after pruning does not by itself mean pruning failed.
- Stopped instance: Compaction should run while n8n is not writing to the file. Plan a window and stop the service cleanly first.
- Backup first: Copy the database with n8n stopped and confirm the copy opens before you change anything. Keep the n8n encryption key with the backup, because stored credentials cannot be read without it.
- Version check: Confirm the compaction steps against your n8n release and the SQLite version on your host. Do not assume a procedure written for another version applies.
Ask the team that runs n8n to write down the stop, backup, compaction and restart steps, then test them on a copy before the first production run.
Keeping audit evidence without keeping every execution
Pruning removes execution history, so decide what evidence you need before you turn it on. A lean n8n database keeps storage and query times under control, but the same execution records are often what security, compliance and incident response teams use to reconstruct who triggered a workflow, what data it touched and whether it ran as designed. Those teams are rarely the ones who set the pruning values, so the first task is to bring them into the decision and agree which evidence must outlive the operational window. Ask each owner which workflows touch personal data, payment or health records, production credentials or external systems, and whether they need execution data or only a record that a run happened.
Separate operational logs from execution data before you rely on either. Execution data is the per-run record stored in the database, including inputs and outputs that pruning can remove. Operational logs are written by the process to its log destination and are managed by your logging platform and its retention rules. Confirm with your platform team where n8n logs go, how long they are kept and whether they capture the workflow identifiers and timestamps your investigators need. If retention for audit-relevant workflows must be longer than the execution window, plan that evidence in the logging or archive layer and document where each field lives, rather than assuming the database will hold it.
Write the pruning settings into your change-management and data-retention policy before they are switched on, and treat backups taken before pruning as a separate retention decision. A pruning change should follow the same approval path as other production changes, with a named owner, a recorded rationale per workflow class and a rollback note. Backups are the other place old execution data lives: a snapshot taken before pruning still contains the records you removed from the live database, so its own retention period, access list and deletion date must be reviewed with the same owners. Ask your data protection and security leads to sign off on both the live and backup retention rules together.
Security and data handling risks of pruning and retention
Pruning removes execution data, but the same deletion can destroy evidence, leave copies in backups, or quietly change what is kept. The cards below cover the risks that connect retention settings to incident response, access control, change control and recovery, with the check to run for each.
Deleting evidence before an incident review
Aggressive pruning can remove the execution records an incident responder needs to reconstruct what a workflow did, which data it touched and when. Before you set a short retention window, agree with the security team how long execution history must remain available for investigations. Confirm whether a legal hold or open-incident process can pause pruning for specific workflows, and who has authority to trigger it.
Backups keeping pruned data
Pruning only affects the live database. Nightly dumps, snapshots and replicas can keep execution data for far longer than your policy allows, so deleted personal or sensitive content may still exist. Map every backup location, its retention period and its rotation schedule. Ask the platform team whether backup retention is written into the same policy as pruning and whether expired backups are actually deleted.
Access to the database and backups
Execution data often contains request bodies, API responses and customer records, so direct database access exposes more than the n8n interface shows. Limit database roles to the n8n service account and named administrators, and restrict who can read backup storage. Confirm that database access and backup downloads are logged, and that those logs follow the same retention rules as the data they describe.
Sensitive payloads in execution data
Execution data stores the input and output of each node, so a token, card number or patient identifier that passes through a workflow is saved with the run. Decide per workflow which data must be saved at all, and turn off saving of successful or manual executions where the payload is sensitive. Confirm with the workflow owners which nodes handle regulated data and whether they need redaction before data reaches a node that records output.
Pruning changes made without review
A change to age or count limits, or a per-workflow override, can alter what evidence exists without anyone noticing. Store pruning settings in version-controlled configuration, require a second reviewer for changes, and record who changed each value and why. Ask the platform team where these settings live, whether environment variables or the instance settings page is used, and how a change is logged.
Testing restores after compaction
After pruning, SQLite and PostgreSQL may need space reclaimed, and any compaction or rebuild step changes files on disk. A backup taken before or during that work may be the only copy you can restore from, so restore tests must run on the post-compaction state. Confirm with the platform team that a restore is tested on a separate host, that the restored instance starts with its encryption key, and that workflows and credentials come back intact.
Questions teams ask before pruning n8n executions
How long does it take for pruning to show results?
Pruning removes old execution records on a schedule, so the first visible effect usually appears after the first pruning cycles run against a backlog of old data. How quickly the database shrinks depends on how many executions you have, how large their saved data is, and how far back your retention window reaches. A large backlog can take several cycles to clear, and the database file or tablespace may not shrink until you reclaim its space. Before you commit to a schedule, ask the partner to measure your current execution count, average stored size per execution, and the age of your oldest records, then present a planned sequence for clearing the backlog and reclaiming space. Confirm the expected behavior against the n8n version you run, because pruning settings can differ between releases.
Does pruning shrink the database file automatically?
No. Deleting execution rows frees space inside the database for reuse, but the file on disk or the PostgreSQL tablespace usually keeps its size unless you run a reclaim step. In SQLite, the file can be compacted with a vacuum operation, which needs free disk space roughly equal to the database size and can lock the file while it runs, so plan it for a maintenance window and take a backup first. In PostgreSQL, plain VACUUM marks space for reuse without returning it to the operating system, while VACUUM FULL rewrites the table and takes an exclusive lock. Ask your team or partner to confirm which method fits your database platform, your downtime limits and your storage monitoring.
What does pruning need from our internal team?
Your team needs an owner who can decide retention rules, a person who can review the database and storage metrics, and access to change the n8n environment settings and restart the service. Business owners of workflows must confirm which executions they need for audit, troubleshooting or customer disputes, because those answers set the retention window. Database administrators need to own backups, the maintenance window for reclaiming space and any alerting on disk use. Expect the internal work to be mostly decision-making and review, with the configuration change itself being small. Ask any partner to list which of these roles they will fill and which they expect your staff to cover.
Can our own team prune n8n executions without a partner?
Yes, many teams can set execution pruning themselves, provided they have someone comfortable with n8n environment variables, database backups and SQL maintenance. The harder parts are the decisions: which executions to save for each workflow, how long to keep failed runs, and how to handle workflows that process personal or health data. Per-workflow overrides also need someone who knows the business purpose of each workflow. A partner adds value when the instance has many workflows with mixed sensitivity, when the database platform needs a tested reclaim procedure, or when your compliance team needs documented evidence of the retention decisions. Ask yourself whether your team can test a restore and a reclaim step on a copy before running them in production.
What makes the pruning effort larger or smaller?
The main drivers are the number of workflows, the volume and size of stored execution data, the database platform, the retention rules and the sensitivity of the data processed. More workflows with different retention needs mean more per-workflow decisions and more review. Large saved payloads, such as full JSON or file content, increase both storage use and the time needed to reclaim space. SQLite and PostgreSQL differ in how space is reclaimed and how much downtime the reclaim step may need. Sensitive data can add approval steps, documentation and testing of deletion behavior. Ask for each of these drivers to be assessed in the scope, because they determine how much work the engagement contains.
What should we ask for in a fixed-scope pruning quote?
Ask for a written scope that names the n8n version, the database platform and version, the number of workflows in scope and the retention rules to be applied. The quote should list each deliverable, such as a current-state measurement, a retention decision record, the configuration change, a tested reclaim procedure and a documented rollback. It should state what is one-time work and what recurs, such as monitoring or periodic reviews, and whether a retainer is needed for ongoing checks. Ask which tasks the team must complete, which systems need access, and what happens if the environment differs from the assumptions in the scope. Compare quotes on these items rather than on the total alone.
How do we confirm pruning is safe before running it on production?
Test the change on a copy of the production database that has a realistic size and a recent backup. Confirm the retention settings, check that the executions your business needs are still present, and verify that workflows with per-workflow overrides behave as documented for your n8n version. Measure disk use before and after, and record the timing of the reclaim step so you can plan the maintenance window. Keep a verified backup and a written rollback path before the production run. Ask your partner or internal team to document these checks, because auditors and security reviewers often ask how retention changes were tested.
Limits and what to confirm in your environment
Pruning behavior depends on the n8n version, the deployment mode and the database platform in use, and none of those are fixed by the workflows themselves. The cards below list the points to confirm in vendor documentation and in a test instance before you set retention values in production, since each one can change how much data remains and how much space is actually returned.
Setting names in your version
Pruning settings are named in environment variables and configuration keys that can change between releases, so the names in a blog post or an older runbook may not match the version you run. Confirm the exact names, default values and units for the n8n release you deploy, and record them in your change ticket. Check the release notes for the version you are upgrading to before you copy any setting forward.
- Latest release cited
- 2.43
Pruning in queue mode
In queue mode, the main instance and the worker pool write to the same PostgreSQL database, so pruning runs against data that many processes produce. Confirm which process performs pruning, whether every worker needs identical settings, and how a worker that is restarted or scaled out behaves. Test with a realistic number of workers before you rely on the settings in production.
Queue mode docsPer-workflow overrides by plan
Ask whether per-workflow save and retention settings are available in the edition and plan you are licensing, because feature availability differs between the Community edition and paid plans. Confirm the override precedence with the instance-wide setting, and check whether an override can keep executions longer than the global limit. Document any workflow that is exempt from the default so auditors can see why its history differs.
n8n pricing pageSpace reclaimed after deletes
Deleting rows in PostgreSQL does not always return disk space to the operating system, because the database keeps freed pages for reuse. SQLite behaves differently and may need a separate maintenance step to shrink the file. Measure the database size before and after a pruning run in a test environment, and plan a maintenance window if you need to reclaim space. Confirm which step your platform requires.
PostgreSQL upgrade docsBinary data outside the table
Pruning removes execution rows, but files stored in the database or on disk may remain behind unless binary data handling is configured to follow the execution lifecycle. Confirm where binary data is kept in your deployment, how its cleanup is tied to execution deletion, and whether external storage needs its own lifecycle rules. Check disk usage on the storage path as well as database size.
Confirming behavior after upgrades
Pruning code, default values and database schema can change with each n8n release, so behavior that worked on one version may differ on the next. After every upgrade, run a pruning test on a copy of production data, compare row counts and database size, and confirm that recent executions needed for audits still exist. Keep a rollback plan that includes the database snapshot taken before the upgrade.
How DeployOpen scopes and delivers execution pruning work
DeployOpen approaches execution pruning as a scoped piece of work on your own n8n instance and database. We agree which executions to keep, how long to keep them and how space is reclaimed before any setting changes, then test the result on a copy of your data and document it for your operators.
How we scope
- Inventory which workflows produce large execution payloads and which ones must keep full execution history for audit or support.
- Agree written retention rules for each workflow group, including any per-workflow overrides, before settings are changed.
- Confirm whether the instance runs SQLite or PostgreSQL, since space reclamation steps differ between the two databases.
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts. Ongoing support is available as a retainer.
How we build
- Measure current database size and execution volume so pruning settings are tested against your real growth pattern, not a guess.
- Set pruning age and count limits in the instance configuration and apply per-workflow overrides where your rules require them.
- Test a reclaim procedure on a restored copy of the database, checking disk usage before and after vacuum or maintenance steps.
- Confirm that workflow data needed for debugging, reporting and audit is still available after pruning runs.
How we hand over
- Document the agreed retention rules, configuration keys and the reasoning behind each per-workflow exception.
- Provide a runbook for checking database size, running reclaim steps and recovering from an accidental deletion through backups.
- Walk through the monitoring signals your team should watch, such as database growth rate and disk free space alerts.
- Record the PostgreSQL or SQLite version in use so later upgrades are planned against the supported version list.
How we support
- Review retention settings when workflow volume changes or when new workflows add large payloads to the instance.
- Retest pruning and reclaim steps during n8n version upgrades and PostgreSQL minor or major upgrades.
- Support is available through a retainer that covers periodic review, upgrade testing and changes to retention rules.
- Ask any provider to confirm the response terms and scope of ongoing support in the written agreement.

