# Performance Issues with PostgreSQL Node Inserts – Possible Refactoring?

**URL:** <https://community.n8n.io/t/performance-issues-with-postgresql-node-inserts-possible-refactoring/248732>\
**Category:** Questions\
**Tags:** postgres\
**Created:** [January 12, 2026, 11:58am UTC](https://community.n8n.io/t/performance-issues-with-postgresql-node-inserts-possible-refactoring/248732 "2026-01-12T11:58:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrazon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mrazon/32/72253_2.png) [@mrazon](https://community.n8n.io/u/mrazon)\
**Post date:** [January 12, 2026, 11:58am UTC](https://community.n8n.io/t/performance-issues-with-postgresql-node-inserts-possible-refactoring/248732/1 "2026-01-12T11:58:07Z")

</div>

## Describe the problem/error/question

I’ve noticed that inserting data into a PostgreSQL database using the **PostgreSQL node** in n8n can be quite slow. For example, inserting **1,000 records takes around 4 seconds** , regardless of which batch option I choose (single, independent, or transaction).

After reviewing the behavior, it seems the current implementation performs extensive validation and checks, which significantly increases processing time.

To test an alternative, I used a **Code node** to build a single query like:  
INSERT INTO table (columns) VALUES (valueN)

Then I executed this query through the PostgreSQL node. This approach reduced the insertion time from **4 seconds to about 500 ms**. When testing with **200,000 records** , the time dropped from roughly **10 minutes (even with batch splits of 1,000)** to **30 seconds**.

However, this workaround has side effects:

1. Increased CPU and RAM usage when running everything in a single workflow.

2. Using sub-workflows or webhooks creates unnecessary workflow history entries for what is essentially one operation.

**Question:**  
Would you consider **refactoring the PostgreSQL insert logic** to make it more efficient? Optimizing this could:

- Reduce overhead from excessive validation.

- Improve performance for large inserts.

- Keep everything within a single workflow without hacks.

This would make PostgreSQL inserts in n8n much more practical for high-volume data ingestion.

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

## Please share your workflow

## Share the output returned by the last node

## Information on your n8n setup

- **n8n version: 2.2.6 (but vetsion is independent for postgresql node)**
- **Database (default: SQLite): postgresql**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main): queue**
- **Running n8n via (Docker, npm, n8n cloud, desktop app): docker**
- **Operating system: red-hat**

---

<div class="post-metadata">

**Author:** ![mrazon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mrazon/32/72253_2.png) [@mrazon](https://community.n8n.io/u/mrazon)\
**Post date:** [January 18, 2026, 7:00am UTC](https://community.n8n.io/t/performance-issues-with-postgresql-node-inserts-possible-refactoring/248732/3 "2026-01-18T07:00:02Z")

</div>

Hi @Nifemi_Emmanuel,

thanks for suggestions. If you see the workflow i shared, that is exactly what I’m doing….but instead of keeping the workflow clean without custom Code, much better option would be to enhance the Postgres node.

The solution with custom Code to create one query is not always so forward, as the query has it’s length limitation, so usually I have Loop For Each → Aggregation (by 10000) → Code (Query for 10000 items)

---

<div class="post-metadata">

**Author:** ![mrazon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mrazon/32/72253_2.png) [@mrazon](https://community.n8n.io/u/mrazon)\
**Post date:** [January 18, 2026, 1:39pm UTC](https://community.n8n.io/t/performance-issues-with-postgresql-node-inserts-possible-refactoring/248732/5 "2026-01-18T13:39:58Z")

</div>

Thanks for info, I was also trying to the another workaround for large SQL insert, to create CSV file, copy it directly to the SQL server and run COPY FROM CSV directly in the server, BUT this works only when you have full access to the SQL server, which in most cases I do not have.

Is there any option or channel where I can put this as feature req?

---

<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:** [January 26, 2026, 9:24am UTC](https://community.n8n.io/t/performance-issues-with-postgresql-node-inserts-possible-refactoring/248732/8 "2026-01-26T09:24:57Z")

</div>

Closed on January 26, 2026, 9:24am UTC

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