# Large Batch Updates Efficiently in PostgreSQL with n8n?

**URL:** <https://community.n8n.io/t/large-batch-updates-efficiently-in-postgresql-with-n8n/305296>\
**Category:** Questions\
**Created:** [July 29, 2026, 12:15am UTC](https://community.n8n.io/t/large-batch-updates-efficiently-in-postgresql-with-n8n/305296 "2026-07-29T00:15:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabby\_Timothy](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gabby_timothy/32/175253_2.png) [@Gabby\_Timothy](https://community.n8n.io/u/Gabby_Timothy)\
**Post date:** [July 29, 2026, 12:15am UTC](https://community.n8n.io/t/large-batch-updates-efficiently-in-postgresql-with-n8n/305296/1 "2026-07-29T00:15:47Z")

</div>

HELLO  
I’m working on a workflow that processes thousands of records at a time, and I’m trying to find the most efficient way to update PostgreSQL without hurting performance.  
UPDATE workflow\_jobs  
SET status = ‘completed’  
WHERE job\_id = 1001;  
I’m wondering if batching updates is a better approach when dealing with large datasets.  
Do you process records in batches or all at once?  
What’s a good batch size in production?  
Have you noticed any performance or locking issues with large batch updates?  
Any PostgreSQL or n8n best practices for handling high-volume updates efficiently

## Describe the problem/error/question

## What is the error message (if any)?

## Please share your workflow

```auto
(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.)

```

## Share the output returned by the last node

## Information on your n8n setup

- **n8n version:**
- **Database (default: SQLite):**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app):**
- **Operating system:**

---

<div class="post-metadata">

**Author:** ![n8n](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/n8n/32/196425_2.png) [@n8n](https://community.n8n.io/u/n8n)\
**Post date:** [July 29, 2026, 12:16am UTC](https://community.n8n.io/t/large-batch-updates-efficiently-in-postgresql-with-n8n/305296/2 "2026-07-29T00:16:28Z")

</div>

Hey @Gabby_Timothy, while you wait for a response, here are some things that might help:

> **Suggested resources**
>
> _Automatically matched to your question._
> 
> **Docs:**
> 
> - [Postgres](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.postgres#execute-query)
> - [Postgres](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.postgres)
> - [Postgres](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.postgres#insert-or-update)
> 
> **Forum:**
> 
> - [Handle Concurrent Updates Without Race Conditions](https://community.n8n.io/t/304108)
> - [High Concurrency PostgreSQL UPSERT Deadlocks & Connection Pool Exhaustion in n8n](https://community.n8n.io/t/264451)
> - [Prevent Slow Queries as n8n Scales](https://community.n8n.io/t/303062)

@Niffzy - you’ve helped with similar issues before, can you take a look?

_Automatically suggested by n8n’s community bot. It’s a pilot - [please share feedback here](https://community.n8n.io/t/pilot-forum-helper-bot/304669)._

---

<div class="post-metadata">

**Author:** ![Emmas](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/emmas/32/173846_2.png) [@Emmas](https://community.n8n.io/u/Emmas)\
**Post date:** [July 29, 2026, 12:21am UTC](https://community.n8n.io/t/large-batch-updates-efficiently-in-postgresql-with-n8n/305296/3 "2026-07-29T00:21:38Z")

</div>

Hey there @Gabby_Timothy

From what I’ve seen, processing records in smaller batches usually performs much better than trying to update everything in one large transaction.

UPDATE workflow\_jobs  
SET status = ‘completed’  
WHERE job\_id IN (1001, 1002, 1003);

Keeping each transaction short reduces lock contention and makes it less likely to impact other workflows running at the same time.

I would also recommend indexing the columns you’re filtering on and monitoring query performance as your data grows. The ideal batch size really depends on your workload, so it’s worth testing a few different sizes to see what works best.

smaller, well-managed batches tend to be more reliable and easier to scale than one large update.

---

<div class="post-metadata">

**Author:** ![Gabby\_Timothy](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gabby_timothy/32/175253_2.png) [@Gabby\_Timothy](https://community.n8n.io/u/Gabby_Timothy)\
**Post date:** [July 29, 2026, 12:27am UTC](https://community.n8n.io/t/large-batch-updates-efficiently-in-postgresql-with-n8n/305296/4 "2026-07-29T00:27:32Z")

</div>

Thanks but how do you usually decide on the right batch size in production? Do you start with a fixed number of rows and adjust based on performance, or do you use metrics like query time, CPU usage, or lock waits to determine the optimal size?

---

<div class="post-metadata">

**Author:** ![Emmas](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/emmas/32/173846_2.png) [@Emmas](https://community.n8n.io/u/Emmas)\
**Post date:** [July 29, 2026, 12:30am UTC](https://community.n8n.io/t/large-batch-updates-efficiently-in-postgresql-with-n8n/305296/5 "2026-07-29T00:30:57Z")

</div>

@Gabby_Timothy

I usually start with a reasonable batch size based on the workload, then adjust based on performance metrics. There isn’t a universal number because it depends on factors like table size, query complexity, indexes, and available resources.

I normally monitor: Query execution time  
Lock wait time  
Database CPU and memory usage  
Transaction duration

If batches are too large, they can hold locks longer and affect other workflows. If they’re too small, you may create unnecessary overhead from too many transactions.

The goal is to find a balance where each batch completes quickly while keeping the database responsive. In production, gradual tuning based on real workload data usually works better than choosing a fixed batch size upfront.

---

<div class="post-metadata">

**Author:** ![Gabby\_Timothy](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gabby_timothy/32/175253_2.png) [@Gabby\_Timothy](https://community.n8n.io/u/Gabby_Timothy)\
**Post date:** [July 29, 2026, 12:35am UTC](https://community.n8n.io/t/large-batch-updates-efficiently-in-postgresql-with-n8n/305296/6 "2026-07-29T00:35:04Z")

</div>

Thanks for the explanation @Emmas

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [August 5, 2026, 12:35am UTC](https://community.n8n.io/t/large-batch-updates-efficiently-in-postgresql-with-n8n/305296/7 "2026-08-05T00:35:06Z")

</div>

Closed on August 5, 2026, 12:35am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
