Skip to content
rushdb
FeaturesUse casesPricingBlogDocsGitHub
Sign InStart free

Agent memory

Agents that remember, and can show where a memory came from.

Company brain & RAG

Answers that span your docs, CRM, support, billing and code, with the record behind every fact.

AI search & assistants

Search and assistants on the records your app already writes.

Analytics

Questions about your data, answered by a read-only query you can inspect.

All use cases →
rushdb

The open-source database for AI. Store any data; your agents always know what’s in it.

GitHubDiscord

Product

FeaturesQuery languagesPricing and CloudSecurity

Use cases

Agent memoryCompany brain & RAGAI search & assistantsAnalytics

Developers

DocsQuick tutorialSelf-hostingTutorialsEngine manualSDKsMCP serverAgent skills

Resources

BlogGuidesComparisonsChangelogllms.txtGitHubContact
PrivacyTermsCookies

You probably don't need a graph database

I build a graph database, and most teams asking me about one should stay on Postgres. When recursive CTEs are enough, and where the graph regret comes from.

Author
Artemiy Vereshchinskiy
Category
Engineering
Published
Nov 19, 2026
Reading time
8 min
Contents
  1. └The skeptic case is a good one
  2. └When Postgres is enough
  3. └Where the regret comes from
  4. └When it does stop being enough
  5. └What I'd do instead of choosing up front
  6. └So

Contents

  1. └The skeptic case is a good one
  2. └When Postgres is enough
  3. └Where the regret comes from
  4. └When it does stop being enough
  5. └What I'd do instead of choosing up front
  6. └So
░░░░░░░░░░░░░░░░░░░░░░░░00%

8 min read

Topics

  • essay
  • graph-database
  • postgres
  • sql

Share

  • X.com
  • LinkedIn

RushDB

Precision your agents can query.

RushDB is a self-describing, graph-native database that helps AI agents reason over data with confidence: progressively introspect what's queryable—without guesswork.

Start free →

Related reading

  1. Nov 19, 2026Single writer by design: why RushDB batches8 min
  2. Nov 19, 2026Databases are closing up. RushDB is going the other way8 min
  3. Nov 11, 2026Time to move on: why RushDB took the hard path off Neo4j13 min

In October 2025 somebody asked Hacker News a simple question: what's your experience with using graph databases for agentic use-cases? The top answer was not kind. "Graph databases are one of those things that sound neat but you'll be hard pressed to find people using them that don't regret it," wrote fidotron, and then described a senior architect explaining "exactly why he regretted introducing Neo4J several years earlier and how all the work is really about getting away from it."

Further down, adidoit: "After a few weeks of getting frustrated I went back to good old Postgres." And victor9000, in one line, the whole thesis of this post: "Postgres and recursive CTEs will let you simulate graph traversal with the benefit of still having a Postgres db for everything else."

I build a graph database, and IMO they're mostly right.

Not fully, though. One person in the same thread built a social network in both MySQL and Neo4j and said Neo4j "worked way better", and I believe him. But most teams who come to me asking "should we use a graph database for our agent memory / knowledge base / RAG" should not. They should stay on Postgres, and I'd rather say that here than sell them something they'll regret.

The skeptic case is a good one

Hamel Husain and Jo Kristian Bergum made the cleanest version of this argument in a talk literally called You Don't Need a Graph DB, and Hamel's written notes are worth ten minutes. Their point is that unless you clearly need low-latency multi-hop traversal, you probably don't need a specialized graph database. And the line I like most: "If you're using modern vector search, you're already using graphs." HNSW is a graph. You didn't need Neo4j to get it.

The pitch they're pushing back against goes like this: knowledge is connected -> connected means graph -> graph means graph database -> buy one. Every arrow there is a jump. Knowledge being connected says nothing about how you should store it. A foreign key is a relationship. A join is a traversal. Relational databases have been doing one-hop and two-hop for decades and they're very good at it.

When Postgres is enough

I give people a boring test. Take the graph question you actually have and write it as a recursive CTE. If it fits on a screen and runs fast enough on your data, you're done and can close the graph database tab.

An org chart, made-up data, everyone under Omar:

sql
CREATE TABLE employee (id int PRIMARY KEY, name text, manager_id int REFERENCES employee(id));
INSERT INTO employee VALUES
 (1,'Dana',NULL),(2,'Omar',1),(3,'Lena',1),(4,'Priya',2),(5,'Tom',2),(6,'Marco',4);

WITH RECURSIVE reports AS (
  SELECT id, name, 1 AS depth FROM employee WHERE manager_id = 2
  UNION ALL
  SELECT e.id, e.name, r.depth + 1
  FROM employee e JOIN reports r ON e.manager_id = r.id
)
SELECT name, depth FROM reports ORDER BY depth, name;
Text
 name  | depth
-------+-------
 Priya |     1
 Tom   |     1
 Marco |     2
(3 rows)

That's PostgreSQL 16, no extension. And the thing people bring up next, "but what about cycles", has been in the SQL standard and in Postgres since version 14: the CYCLE clause. A bad import makes Dana report to Marco, and the walk up the chain stops instead of spinning forever:

sql
UPDATE employee SET manager_id = 6 WHERE id = 1;  -- the bad import

WITH RECURSIVE chain AS (
  SELECT id, name, manager_id FROM employee WHERE id = 6
  UNION ALL
  SELECT e.id, e.name, e.manager_id FROM employee e JOIN chain c ON e.id = c.manager_id
) CYCLE id SET looped USING path
SELECT name, looped FROM chain;
Text
 name  | looped
-------+--------
 Marco | f
 Priya | f
 Omar  | f
 Dana  | f
 Marco | t

So, honestly, use Postgres when:

  • your relationships are a handful of known types (manager, parent, belongs-to, links-to);
  • your traversals have a bounded depth, or a depth you only need on a few queries;
  • you already run Postgres, and the graph data lives next to rows you join against anyway;
  • your team knows SQL better than any graph language (almost every team);
  • what you call "graph RAG" is really vectors plus a couple of filters plus one join.

That's most products I see. The extra database is pure cost there: one more system to run, back up, secure, monitor and explain to the new hire.

Where the regret comes from

Reading that thread again, the regret is rarely "the traversal was slow". It's what came with the database.

You commit to a data model up front. Somebody has to decide what's a node, what's an edge, what's a property, before the data is even understood. That's the ontology work people underestimate, and once it's wrong, it's wrong in every query.

You run a second database. Now there's a sync job between Postgres and the graph, two sources of truth, and the 3 a.m. question of which one is right.

You get one door. The graph speaks its own language; your BI tool, your ORM, your data team speak SQL. Every integration starts with "first learn our database's database". I lived this on the vendor side for two major versions, and I wrote about why we left Neo4j as our foundation. I won't repeat it here.

None of this is about the data structure. Graphs are fine. It's the commitment that hurts.

When it does stop being enough

To be fair to my own category, there are real cases where recursive SQL turns into pain.

  • Many relationship types, unknown paths. "How is this supplier connected to this incident, through anything, up to 5 hops" is miserable as a CTE. Pattern languages exist for this.
  • Path results. When the answer is the path itself, not the endpoint, you start building arrays of ids by hand inside the recursion.
  • An agent writes the queries. A model writing a 30-line recursive CTE with the right join columns is a different risk than a model writing a two-line pattern match. Maybe that's fixable with better tools. Today it's a real difference.
  • The shape keeps changing. New sources every week, new link types every week, and every one is a migration.

If two or three of these are your daily reality, a graph model earns its cost. If it's one of them, on a few queries, it probably doesn't.

What I'd do instead of choosing up front

This part is biased. The question "relational or graph?" assumes you have to choose before you know your data. I don't think you should have to.

What we built RushDB around is the opposite order: JSON in -> linked records -> SQL out, over the same records, with graph languages available later if you need them. You push the data the way your app already has it, nested objects become linked records, and SQL treats labels as tables and relationship types as tables too. Same org chart, as a JSON document:

JSON
{"name":"Dana","title":"CTO","EMPLOYEE":[
  {"name":"Omar","title":"Eng Manager","EMPLOYEE":[
    {"name":"Priya","title":"Staff Engineer","EMPLOYEE":[{"name":"Marco","title":"Engineer"}]},
    {"name":"Tom","title":"Engineer"}]},
  {"name":"Lena","title":"Designer"}]}

Nested objects become child records labelled by their key, which is where the EMPLOYEE label (the employee table in SQL) comes from. Ingested with label: "EMPLOYEE" for the root and relationshipTypes: {"EMPLOYEE": "MANAGES"}, the document comes back as 6 records and 5 MANAGES relationships, and the recursive CTE you already know runs on it:

sql
WITH RECURSIVE reports AS (
  SELECT e.__id AS id, e.name, 1 AS depth
  FROM employee m
  JOIN rushdb_edges.manages r ON r.__source_id = m.__id
  JOIN employee e ON e.__id = r.__target_id
  WHERE m.name = 'Omar'
  UNION ALL
  SELECT e.__id, e.name, rp.depth + 1
  FROM reports rp
  JOIN rushdb_edges.manages r ON r.__source_id = rp.id
  JOIN employee e ON e.__id = r.__target_id
)
SELECT name, depth FROM reports ORDER BY depth, name;
JSON
{"rows":[{"name":"Priya","depth":1},{"name":"Tom","depth":1},{"name":"Marco","depth":2}],"total":3}

Same rows as Postgres. And the day the CTE gets ugly, the same records answer a pattern match, without a migration or a second database:

cypher
MATCH (:EMPLOYEE {name: 'Omar'})-[:MANAGES*1..5]->(e:EMPLOYEE) RETURN e.name AS name ORDER BY name
JSON
{"rows":[{"name":"Marco"},{"name":"Priya"},{"name":"Tom"}],"total":3}

If you're on Postgres and the checklist above fits, stay. What I'm arguing is that the graph shouldn't be a bet you place on day one. The catalog of what's actually stored (labels, fields, types, values, relationship shapes) is kept exact on every write, so you see the shape of your data before you design anything around it, and model later, when you know.

And to keep it honest, the costs on our side: openCypher is still a release candidate in RushDB 3.0 and off until you enable it (SQL and our native query format are the stable surface), the engine runs as a single node today, and SQL there is autocommit only. If you need Postgres transactions, extensions and its decades of hardening, you need Postgres. That's fair anyway.

So

Start with Postgres, write the recursive CTE, add CYCLE, and measure.

If it hurts in two or three of the ways above, look at graph models, and look first at the ones that don't force you to choose your data model before you've seen your data.

If it doesn't hurt, you don't need a graph database. You heard it from someone who sells one.