# How to perform a fuzzy search across conversations when using LangGraph’s AsyncPostgresSaver as a checkpointer?

**URL:** <https://forum.langchain.com/t/how-to-perform-a-fuzzy-search-across-conversations-when-using-langgraph-s-asyncpostgressaver-as-a-checkpointer/1218>\
**Category:** LangGraph\
**Tags:** python-help\
**Created:** [August 18, 2025, 11:38am UTC](https://forum.langchain.com/t/how-to-perform-a-fuzzy-search-across-conversations-when-using-langgraph-s-asyncpostgressaver-as-a-checkpointer/1218 "2025-08-18T11:38:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![giovanni-velais](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/giovanni-velais/32/631_2.png) [@giovanni-velais](https://forum.langchain.com/u/giovanni-velais)\
**Post date:** [August 18, 2025, 11:38am UTC](https://forum.langchain.com/t/how-to-perform-a-fuzzy-search-across-conversations-when-using-langgraph-s-asyncpostgressaver-as-a-checkpointer/1218/1 "2025-08-18T11:38:51Z")

</div>

Hey everyone,

I’ve been using LangGraph (served through a FastaAPI) for a while to serve my assistant to multiple users, and I think I’m using its abstractions in the right way (but open to roasts). In my implementation to persist chat history I use AsyncPostgresSaver as a checkpointer for my Agent:

```python
graph = workflow.compile(checkpointer=AsyncPostgresSaver(self._pool))

```

My thread\_id is a string composed of the user ID plus the date. That way, when I want to list all conversations for a certain user, I run something like:

```sql
SELECT
    thread_id,
    metadata -> 'writes' -> 'Generate Title' ->> 'title' AS conversation_title,
    checkpoint_id
FROM checkpoints
WHERE metadata -> 'writes' -> 'Generate Title' ->> 'title' IS NOT NULL
  AND thread_id LIKE '%%{user_id}%%';

```

Now i got the thread\_id and can display all the messages like this

```python
config: Dict[str, Any] = {"configurable": {"thread_id": thread_id}}
state = await agent.aget_state(config)
messages = state[0]["messages"]
return messages

```

Note: for me a thread is basically a chat with a title, what you would normally see on the left bar of ChatGPT.

**The problem:**

Now I want to search _inside_ a conversation.

The issue is that I’m not 100% sure how the messages are actually stored in Postgres. I’d like to run a string search (or fuzzy search) across all messages of a given user, then group the results by conversation and only show conversations that match.

My questions are:

- Can this be done directly using the AsyncPostgresSaver storage format, or would I need to store the messages in a separate, more search-friendly table?

- Has anyone implemented something like this with LangGraph?

- What’s the best approach to avoid loading every conversation into memory just to search?

- Cause i can see stuff is saved as Binary Data sometimes (which makes sense for documents)? But I cannot believe that the text part of a message is not searchable

Any advice or patterns you’ve found useful would be appreciated!

---

<div class="post-metadata">

**Author:** ![rahul-langchain](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/rahul-langchain/32/637_2.png) [@rahul-langchain](https://forum.langchain.com/u/rahul-langchain)\
**Post date:** [August 19, 2025, 5:25pm UTC](https://forum.langchain.com/t/how-to-perform-a-fuzzy-search-across-conversations-when-using-langgraph-s-asyncpostgressaver-as-a-checkpointer/1218/2 "2025-08-19T17:25:19Z")

</div>

Hi! We don’t support accessing the checkpoint data in Postgres outside of the utilities the LangGraph library provides you. For your use case, it is best to store the conversation data in a separate schema you’ve designed.
