Resources · n8n integration

n8n Postgres PGVector Store nodeConfigure Postgres PGVector Store in n8n.

Your embeddings can live in the same Postgres database as the rest of your data. The n8n Postgres PGVector Store node writes documents into a PGVector table, reads ranked matches back, and hands that table to an AI agent as a tool. Two parameters, four modes.

Verified Trustpilot reviews · AI, automation & growth agency

Why automate

What does the n8n Postgres PGVector Store node do?

PGVector is an extension of Postgresql, and this node is how n8n talks to the PGVector tables in that database. It inserts documents into a vector table, gets ranked documents back for a query, or exposes the table so a chain or an agent can read it. A vector table stores text next to its numeric representation, which is what makes similarity search possible.

The first pattern is the plain one. You place the node in the regular flow of a workflow, pick Insert Documents, and every item that reaches it lands in the table you named. Nothing else is involved: no agent, no chat. It is the ingestion half of a knowledge base, and you usually run it once per new document rather than on a schedule.

The second pattern answers questions. With Get Many, the node takes a search prompt and returns the best matching documents, ranked by similarity. Set Limit to 10 and you get the ten best rows. That output feeds whatever comes next, a summary step or a message sent through Slack.

The third pattern gives the table to an assistant. Retrieve Documents (As Tool for AI Agent) turns the store into a tool that an AI Agent can call on its own, using the Name and Description you write. A tool here is an add-on resource the model consults when it needs facts it does not have. The alternative shape, Retrieve Documents (As Vector Store for Chain/Tool), plugs into a Vector Store Retriever feeding a Question and Answer Chain, or into a Vector Store Question Answer Tool that summarizes results before the agent sees them.

When do you reach for something else? If you never query your documents by meaning, a vector table is the wrong tool and a normal Postgres table does the job. Documents still need to be turned into vectors before they are stored, so the model provider you choose, OpenAI or Google Gemini for instance, bills those API calls under its own terms while n8n adds nothing.

The known limits are worth stating plainly. This node has no trigger: something else has to start the workflow. It runs at version 1, and an older workflow may show fewer options. The page for the n8n review covers the platform side of the decision.

Connect

How do you connect n8n to your PGVector database?

  1. 01

    Create the Postgres credential

    Open the Credentials menu and add the Postgres credential: Host, Database, User, Password, Port, an SSL mode (Allow, Disable or Require) and an Ignore SSL Issues toggle. Create it once and reuse it in every workflow that touches the same database, so a password rotation is a single edit.

  2. 02

    Point the node at a table

    Fill in Table Name with the PGVector table you want to work in. If that table does not exist yet, the node creates it, which is convenient the first time and unforgiving later: a misspelling gives you a brand new empty table instead of an error. Type the name once, then reuse the same value across the insert workflow and the query workflow.

  3. 03

    Pick the mode and run one item

    Set Operation Mode to match what this copy of the node is for, then execute the workflow on a single item. Insert Documents shows you rows arriving. Get Many with a short Prompt shows you whether anything comes back ranked. Doing this before you wire the node to an agent keeps the debugging in one place instead of hidden behind a model call.

Parameters

Which parameters does the node expose?

The Postgres PGVector Store node has 2 parameters. For each one: the node as you configure it in n8n, what the parameter changes, and our field notes.

01

Operation Mode

mode

What you see in n8n

Notes & use cases

This selector decides what the node does with the table, and which fields appear below.

Key parameters

  • Operation Mode: insert (Insert Documents) writes documents in, load (Get Many) returns ranked documents for a query, retrieve (Retrieve Documents (As Vector Store for Chain/Tool)) exposes the store to AI nodes, retrieve-as-tool (Retrieve Documents (As Tool for AI Agent)) exposes it as a tool.
  • Prompt: required in Get Many, the search text ranked against the stored documents, often {{ $json.question }} from the previous node.
  • Limit: how many top results come back.
  • Name and Description: required in tool mode, they tell the model what the store holds.
Use cases
one copy in insert for ingestion, another in load for questions.
02

Table Name

tableName

What you see in n8n

Notes & use cases

Names the table the vectors are stored in. Every mode reads this field, and the node creates the table when it does not exist yet.

Key parameters

  • Table Name: the PGVector table to store the vectors in, typed as a plain string or taken from the item with an expression such as {{ $json.table }} when one workflow serves several datasets.
Use cases
a support knowledge base and a product catalog stay in separate tables, so a question about pricing never ranks a support article. Keep the value identical between the workflow that inserts and the workflow that queries.
Need help

Need help automating Postgres PGVector Store with n8n?

A person reads every message.

FAQ

Postgres PGVector Store and n8n: common questions

01Is the Postgres PGVector Store node included in n8n?
Yes. It belongs to the AI package shipped with n8n, so there is nothing to install and nothing extra to pay on the n8n side. It behaves the same on n8n Cloud, the hosted offer run by n8n, and on a self-hosted instance installed through Docker or npm under the Community Edition and its Sustainable Use license. The same workflow moves between the two without changes. What does have a cost is the model provider you use to turn documents into vectors: OpenAI, Anthropic, Google or Mistral bill their own API calls under their own terms, and n8n adds nothing on top of that.
02What do you need for it to work?
A Postgres database with the PGVector extension, and the Postgres credential this node uses, created once in the Credentials menu and reused everywhere. Beyond that, a table name. You do not have to create the table yourself: if the one you name is missing, the node creates it on the first run. Documents also have to be turned into vectors before they can be stored, which is where your model provider and its credential come in. Once the credential exists in n8n, any other workflow hitting the same database picks it from the list instead of asking again.
03What are the limits of the node?
It is an action node, not a trigger, so it never starts a workflow on its own: a schedule, a webhook or a chat message has to run first. The catalog lists version 1, and a workflow built earlier can display an older version with fewer options. Only what the panel exposes is available, which is the mode, the table name and the fields tied to each mode, so anything beyond that belongs in a regular Postgres query. And since the node creates a missing table silently, a wrong table name produces empty results rather than a clear error message.
04What do you plug into the n8n Postgres PGVector Store node to start?
Start simple, without an agent. Put the node in a normal workflow in Insert Documents mode, send two or three documents through it, then add a second copy in Get Many mode with a short prompt and check that the ranked results make sense. Once that works, choose how the store gets consumed. Retrieve Documents (As Tool for AI Agent) connects straight to the tool connector of an AI Agent. Retrieve Documents (As Vector Store for Chain/Tool) goes through a Vector Store Retriever into a Question and Answer Chain, or through a Vector Store Question Answer Tool that summarizes before answering.
05n8n or Make for a PGVector knowledge base?
The honest split is about hosting and data. Make is hosted by Make, with no self-hosting option, and it bills per operation. n8n runs on your own server if you want it to, which matters here because your vectors and your source documents sit in your own Postgres database and you may prefer that the automation layer stays next to it. On cost, per-operation pricing is predictable when volume is low and less so when an ingestion run pushes thousands of documents. Both build workflows visually, so the choice comes down to where the data lives and how your volume grows, not to one being better.
Hack'celeration Lab

Get our weekly integration tips.

No spam. Unsubscribe anytime.