What the workflow does
A main workflow fans out to 5 parallel branches. Each branch calls a sub-workflow, which in turn calls a lower-level sub-workflow per item. The lowest level is purely decision logic — IF nodes and Set nodes, no external HTTP calls, no DB queries. Total item volume per full run is in the range of 10,000+ executions across all branches.
The symptom
In Execution History, executions appear stuck in “running” state for up to 24 hours. But when they eventually complete, the recorded execution duration shows ~200ms. So the actual work takes 200ms — the other 23h 59m 59s is time spent waiting somewhere in n8n before or after execution.
This tells us the logic itself is fast. The bottleneck is not the workflow code.
What we think is happening
With 10,000+ sub-workflow executions, n8n is writing an execution record to PostgreSQL for every single one. In normal (non-queue) mode these writes are serialized through the same Node.js event loop. By the time a later execution’s “started” or “completed” record gets persisted, real clock time has moved far ahead — so execution history timestamps no longer reflect actual wall time.
The 24h figure is not real processing time. It’s DB write lag.
Questions
Execution saving settings — Is EXECUTIONS_DATA_SAVE_ON_SUCCESS=none (or the equivalent setting in Settings → Workflows) the right lever here? Would disabling success-execution saves on the sub-workflows eliminate the DB write queue entirely?
Per-workflow execution saving — Can you disable execution persistence on individual workflows rather than globally? Our lowest-level sub-workflow fires thousands of times per run and we don’t need its history saved — we only care about the top-level result.
PostgreSQL tuning — Are there specific Postgres settings (connection pool size, autovacuum tuning, write-ahead log settings) that others have used at this volume?
Normal mode concurrency limit — At what point does normal mode fully serialize? We’ve seen some concurrent execution for small N but complete serialization around N=200+. Is there a documented threshold or n8n config for this?
Queue mode trade-off — We understand queue mode + a dedicated worker node would help. But is there anything meaningful we can squeeze out of normal mode first before going that route?
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
To address the bottleneck, disable successful execution saves both globally with EXECUTIONS_DATA_SAVE_ON_SUCCESS=none and per-workflow using “Save” → None in Workflow Settings, and also turn off “Save execution progress” at the workflow level. Setting this per-workflow means your low-level sub-workflows can fire thousands of times without creating database records, while still maintaining visibility of parent workflow success/failure.
For PostgreSQL tuning, increase the connection pool size (e.g., DB_POSTGRESDB_POOL_SIZE=10 instead of the default 2) and configure timeouts appropriately. Control normal-mode concurrency globally with N8N_CONCURRENCY_PRODUCTION_LIMIT (set to -1 to disable). You suspected a serialization point around N=200, likely due to hitting PostgreSQL write limits when using the default low connection pool size.
Queue mode would provide the cleanest solution because it writes the startedAt timestamp to the queue immediately without blocking. However, before going that route, apply the workflow-level and global configuration changes first—if that resolves the 24-hour timestamp lag, you may not need the extra complexity of queue mode. If those normal-mode optimizations don’t help, queue mode with dedicated workers will truly separate execution monitoring from processing.
That 24-hour lag is indeed caused by PostgreSQL serialization bottlenecks from writing 10,000+ individual execution records synchronously to the database on every sub-workflow iteration. You can eliminate this overhead by setting your instance to queue mode with Redis and disabling execution saves for success states on those child workflows via environment variables or workflow settings. Let me know if you need the exact environment variables or Docker compose tweaks to split your worker queues and I can share the configuration right here.
Thanks! It would be really helpful if you could share the exact environment variables and Docker Compose configuration.
Also, I had a question regarding workers. When we say a worker, do we mean a separate process running on the same machine as the main n8n instance, or an entirely separate machine? My concern is that if we’re just running multiple worker processes on the same machine, we might still hit the same CPU and resource bottlenecks, so I’m wondering how much of a performance improvement that would actually provide.
That is a fantastic question about workers, and it touches on the fundamental architecture of Node.js. Same Machine vs. Separate Machine (The Node.js Single-Thread Constraint)
A worker can be either, but starting with multiple workers on the same machine usually gives an immediate 3x–5x throughput boost. Here is why:
Node.js is single-threaded: A single standard n8n process can only ever utilize 1 CPU core, regardless of how beefy your VPS or bare-metal server is. If you have an 8-core CPU, 7 of those cores sit almost completely idle while your single process chokes on execution serialization.
Multi-Worker on Same Host: Running 3–4 worker containers on the same host spins up independent Node.js runtimes. This allows n8n to saturate all CPU cores in parallel.
When to move to separate machines (Horizontal Scaling): You only need separate VMs once the entire host’s RAM or aggregate CPU approaches 75–80%. Because Redis and PostgreSQL decouple execution from state, workers on separate machines simply point to your centralized Redis/Postgres IP.
The Production Docker Compose Setup (Queue Mode)
Here is a battle-tested docker-compose.yml pattern with Redis Queue Mode and Execution DB Offloading configured:
Two Critical Notes for Your Fan-Out Workflows:
EXECUTIONS_DATA_SAVE_ON_SUCCESS=none: This single variable stops n8n from performing a heavy write of the entire JSON payload to the execution_entity table upon completion. If you are fanning out 10,000 sub-workflows, this alone removes millions of unnecessary IOPS from PostgreSQL. (Errors will still be logged so you can troubleshoot failures).
Workflow Settings Override: You can also toggle this per workflow: open your child sub-workflow → Workflow Settings (gear icon top right) → set Save Successful Production Executions to No.
Give that compose setup a spin with replicas: 2 or 3 and let me know if your execution queue drains immediately!
Hi @Raviraj_kale, I’d first test reducing the number of sub-executions. On a copy, send the same 100 items to the IF/Set child using Mode → Run once with all items, verify the outputs, and compare the parent’s wall-clock time with the per-item version.
A few corrections to the advice above:
You can disable Save successful production executions and Save execution progress only on the children, keeping parent history. EXECUTIONS_DATA_SAVE_ON_SUCCESS=none controls saved data; it doesn’t eliminate execution creation or all database writes.
N8N_CONCURRENCY_PRODUCTION_LIMIT doesn’t apply to sub-workflow executions. There isn’t a documented serialization threshold at 200; also check Execution order, because v1 completes canvas branches in turn.
Workers are separate processes, on the same EC2 or separate hosts. Standard nested calls stay in their parent’s process, so extra workers won’t automatically distribute one fan-out or guarantee a 3x–5x improvement.
For PostgreSQL, capture pg_stat_activity waits and CPU/I/O during the same test before changing pool/WAL/autovacuum settings. Budget database connections across the main process and every worker.
For the 24h/200ms discrepancy, could you share your exact n8n version, Execute Sub-workflow settings, and one parent/child pair’s createdAt, startedAt, stoppedAt, alongside the observed start/end times?
Interesting case. I would separate actual workflow execution time from execution-state persistence time before concluding that PostgreSQL is the bottleneck.
One area worth measuring is how much execution data each nested sub-workflow generates and how frequently those records are written.
In my own webhook reliability testing, I focused on concurrent requests, database-backed idempotency, and duplicate prevention. It reinforced the importance of measuring database behavior under concurrency rather than looking only at node execution time.
I would also compare the behavior with successful execution saving disabled for the relevant workload, if the deployment configuration allows it, while retaining the top-level execution data needed for debugging.
Queue mode may help with workload distribution, but I would first verify whether the delay is in execution scheduling, database persistence, or UI status updates.
Massive execution time discrepancies on sub-workflow fan-outs typically point to queue serialization bottlenecks or database lock contention in PostgreSQL. When hundreds of child executions attempt to write their completion states simultaneously, execution records stall in pending states.
Setting EXECUTIONS_DATA_PRUNE=true and tuning PostgreSQL connection pool size usually eliminates the artificial execution duration lag immediately.
Most likely it’s the execution saving, plus every sub-workflow competing for the single process. Turn off saving successful executions and progress on the sub-workflows, and prune old data aggressively. Better still, batch items into one sub-workflow call using Split In Batches rather than one call per item. For this volume, queue mode with workers is the proper fix.
@Raviraj_kale a worker is just another n8n process started with n8n worker. It can run on the same machine or on a different one, it only needs to reach the same Postgres and Redis and use the same N8N_ENCRYPTION_KEY as the main instance.
On one machine, extra workers only help if you have idle CPU cores. Each n8n process is single-threaded Node.js, so right now your main instance is doing everything on roughly one core. Two or three workers on a 4-core VM will use the other cores. If the box is already maxed out, more workers on it won’t help and you need another machine.
One thing that matters a lot for your setup: in queue mode, an Execute Workflow call that waits for completion runs the sub-workflow inside the same worker as the parent. It does not get spread across workers. So your 10k child executions still land on whichever worker picked up the parent run.
The biggest win is usually to cut the number of executions. In the Execute Workflow node that calls the lowest-level sub-workflow, set Mode to “Run once with all items” instead of “Run once for each item”, and let that sub-workflow handle the whole batch. IF and Set nodes work the same on 1 item or 10,000, and you go from thousands of execution records to a handful. Inlining that decision logic into its parent works too.
Postgres is left out since you already run it. Start with docker compose up -d --scale n8n-worker=2.
Two gotchas. If your current instance never had N8N_ENCRYPTION_KEY set, copy the key from /home/node/.n8n/config into the env first, otherwise the workers can’t decrypt your credentials. Also keep main and workers on the exact same image version.