---
title: "Comment by Adam Lewis on \"MongoDB vs PostgreSQL for a LangGraph RAG Agent: How to Choose\" | Hashnode"
description: "Both work, but the trade-off is in how much of the agent's state you want the database to understand. First, pin down what the checkpoints are for. If a checkpo"
url: "https://hashnode.com/posts/mongodb-vs-postgresql-for-a-langgraph-rag-agent-how-to-choose/6afd5556c50b19cb9ff6d2d2/comment/6b055cc0f36224f426877890"
---

[Discussion](https://hashnode.com/posts/mongodb-vs-postgresql-for-a-langgraph-rag-agent-how-to-choose/6afd5556c50b19cb9ff6d2d2)

Comment [MongoDB vs PostgreSQL for a LangGraph RAG Agent: How to Choose](https://hashnode.com/posts/mongodb-vs-postgresql-for-a-langgraph-rag-agent-how-to-choose/6afd5556c50b19cb9ff6d2d2)

[Adam Lewis](https://hashnode.com/@nark3d)

[Nov 24](https://hashnode.com/posts/mongodb-vs-postgresql-for-a-langgraph-rag-agent-how-to-choose/6afd5556c50b19cb9ff6d2d2/comment/6b055cc0f36224f426877890)

Both work, but the trade-off is in how much of the agent's state you want the database to understand. First, pin down what the checkpoints are for. If a checkpoint is just a way to resume a conversation and look back at a past run, then keeping old runs is all you're asking of it and either database handles that fine. If they're also how you replay a thread to debug or evaluate the agent, then the checkpoint is a queryable record and the schema around it matters a lot more than the choice of store. Which of those is the agent you're shipping meant to do?

[BoilerShelf](https://hashnode.com/@boilershelf)

[6d ago](https://hashnode.com/posts/mongodb-vs-postgresql-for-a-langgraph-rag-agent-how-to-choose/6afd5556c50b19cb9ff6d2d2/comment/6b055cc0f36224f426877890#reply-6b065cab09ba38af51bf5134)

Great framing, thanks Adam. That distinction is the real decision, and I should have made it explicit in the post.

If checkpoints are only for resuming threads, either store is fine and the main work is a retention policy, because every step writes one.

If you want to replay and evaluate runs, one caveat: the checkpointer serializes state for resuming, not for querying. Questions like "which threads called tool X and then failed" get awkward against raw checkpoints in either database. What has worked better is writing a small run/event record alongside the checkpoint (thread ID, step, node, tool calls, latency, outcome) with a schema you control. At that point PostgreSQL has the edge for me: you can join those records to users and documents and query them with plain SQL. MongoDB is still a good fit if your team lives in aggregation pipelines.

So resume-only, pick what your team runs. Replay and evals, design the run record first and let that choose the store.

Are you treating checkpoints as your eval source today, or logging traces separately?
