Giving your agents persistent memory with Postgres + pgvector
An agent with no memory starts from zero every run. As soon as you want it to remember a past conversation or a document it already processed, you need a vector store.
Why not a dedicated managed service
Managed vector databases (Pinecone, Weaviate Cloud, etc.) are quick to set up, but add one more service to monitor, a recurring cost, and an external network dependency for every call.
The pgvector option
pgvector is a Postgres extension that adds a vector column type and similarity operators. If you already run Postgres for the rest of your stack (users, logs, config), adding pgvector costs nothing but enabling an extension.
Concrete benefits:
- One database to back up instead of two separate systems.
- Regular transactions: you can link a vector entry to a business row in the same SQL transaction.
- Hosting cost limited to a Postgres instance you already run on your VPS.
When it stops being enough
Past a few million vectors with very strict latency requirements, a specialized vector database regains the edge thanks to more optimized indexes. For the vast majority of personal agents or small teams, pgvector holds up just fine.