Comparison

retainr vs n8n Postgres Chat Memory: Semantic Memory Without a Database

The n8n Postgres Chat Memory node stores the last N messages in a database you manage. retainr stores any content and retrieves the most semantically relevant memories — no database required. Install as a community node in 30 seconds.

Feature comparison

FeatureretainrPostgres Chat Memory
Setup time30 seconds30-60 minutes
Database requiredNoYes (Postgres instance)
Semantic search✓ pgvector HNSW✗ None (last N messages)
Cross-execution memory✓ Always✓ Within session scope
Multi-user namespacing✓ Built-inManual (session_id field)
TTL / auto-expiry✓ Per-memory TTL✗ Manual cleanup required
Works outside n8n✓ REST API✗ n8n-only
Managed cloud✓ Fully managedSelf-managed
Free plan✓ 1,000 ops/moFree (self-hosted)
Storage costIncludedYour DB bill

Recency vs. relevance

Postgres Chat Memory retrieves by recency

The node returns the last N messages in the conversation window. If the user mentioned a critical detail in message 20 but the window is set to 10, that detail is gone. Recent messages are always returned — relevant messages are not guaranteed.

[msg 91] User: hi
[msg 92] Bot: hello
[msg 93] User: what time is it
[msg 94] Bot: ...
[msg 20] User: my allergy is nuts ← lost

retainr retrieves by relevance

retainr uses semantic search across all stored memories. A memory from 3 months ago is retrieved if it is the most relevant to the current query — regardless of when it was stored. The AI always gets the most useful context, not just the most recent.

Query: "dietary preferences"

↳ [msg 20] User mentioned nut allergy ✓
↳ [msg 47] User is vegetarian ✓
[msg 91-94] small talk — excluded

Migrating from Postgres Chat Memory to retainr

Already using Postgres Chat Memory and want semantic search without the database overhead? Migration takes under 10 minutes.

  1. 1
    Install the retainr community node

    Settings → Community Nodes → Install → n8n-nodes-retainr. Add your retainr API key as a credential.

  2. 2
    Replace the Postgres Chat Memory node

    Remove the Postgres Chat Memory node from your AI Agent. Add a retainr Search Memory node before the AI step and a retainr Store Memory node after.

  3. 3
    Inject search results into the prompt

    Map the retainr search results into your AI system prompt: {{ $node["retainr_search"].json.results.map(r => r.content).join("\n") }}

  4. 4
    (Optional) Migrate existing history

    Export rows from your Postgres chat_history table and POST each row's content to retainr with the matching namespace. Old history becomes semantically searchable.

retainr vs Postgres Chat Memory — frequently asked questions

What is the n8n Postgres Chat Memory node?
The Postgres Chat Memory node is a built-in n8n AI Agent memory option that stores conversation history in a Postgres database table you manage. It is part of n8n's LangChain AI module and works by storing message arrays per session_id. When the AI Agent runs, it loads the last N messages for that session to provide context.
What are the limitations of the Postgres Chat Memory node?
Three main limitations: 1) No semantic search — it returns the most recent N messages, not the most relevant memories. A key fact from 3 weeks ago is excluded if it falls outside the message window. 2) Requires a Postgres database — you provision, back up, and maintain it yourself. 3) It only works inside n8n's AI Agent node and cannot be shared with other platforms like Make.com or Zapier.
Can I use retainr as a drop-in replacement for Postgres Chat Memory?
Yes. retainr's Search Memory node replaces the Postgres Chat Memory retrieval. Instead of loading the last N messages, retainr returns the most semantically relevant memories for the current query — typically better context for the AI. The Store Memory node replaces the write path. Install n8n-nodes-retainr and swap out the Postgres Chat Memory node.
Does retainr require Postgres?
retainr uses pgvector on Postgres internally, but you do not manage it. The database is fully managed in retainr's infrastructure. You never touch a connection string, schema, or backup job. From your perspective, retainr is a stateless HTTP API.
When should I keep using the Postgres Chat Memory node?
Keep it if you already run Postgres for other reasons and want zero external dependencies. Also keep it if you need strict data residency — your data stays on your own database. Use retainr when you want semantic search over past interactions, need no database setup, or want memory that works across multiple automation platforms.
Does retainr work with the n8n AI Agent node?
Yes. retainr integrates with the n8n AI Agent workflow pattern — it is not limited to the AI Agent node itself. The most common pattern: add a retainr Search Memory node before the AI Agent to retrieve relevant context, inject the results into the system prompt, then add a retainr Store Memory node after to save the exchange.

Semantic memory for n8n — no Postgres required

1,000 memory operations per month. Free forever. No credit card required.

Start free