n8n on Railway: How to Safely Clean Execution Tables and Reduce a 50+ GB Postgres Volume
krunalb
PROOP

3 months ago

We’re running n8n on Railway with a managed Postgres instance whose attached volume has grown past 50 GB and is now full. Most of that space is in n8n’s execution tables (execution_entityexecution_dataexecution_metadata ,binary_data).
In this Railway setup we don’t have shell access to the n8n services or any SQL console for Postgres, so we can’t run maintenance commands like TRUNCATE and VACUUM FULL on those tables. Because of that, we currently have no way to clear past executions and reduce the database volume.
Looking for guidance on the simplest supported way to clean or truncate these execution tables and shrink the Postgres volume on Railway, or any recommended pattern to temporarily gain the SQL access needed to do this maintenance.

$10 Bounty

1 Replies

shakirali78690
FREE

3 months ago

Most of your space is in n8n’s execution tables, so you’ll need two things:

Turn on n8n’s built‑in pruning so new executions don’t keep filling the DB (EXECUTIONS_DATA_PRUNE=true, EXECUTIONS_DATA_MAX_AGE=…, optionally EXECUTIONS_DATA_SAVE_ON_SUCCESS=none).

Get one‑off SQL access to the Railway Postgres (via a temporary pgAdmin/Adminer/psql container using the DATABASE_URL from the Postgres service) and run cleanup queries that delete old rows from execution_entity, execution_data, execution_metadata, and binary_data.

Only deleting data (and ideally running VACUUM FULL or migrating to a fresh DB) will actually shrink the 50+ GB volume; pruning alone only stops it from growing further.


Loading...