Skip to content
Ian Cunningham monogram Ian Cunningham AI systems builder

Blog

PostgreSQL: The Swiss Army Knife for Agentic Databases

Modern AI systems increasingly tempt developers toward specialized databases for every problem. In practice, PostgreSQL can often handle far more than people realize.

PostgreSQL: The Swiss Army Knife for Agentic Databases
KT

Article summary

Key Takeaways

  1. PostgreSQL can handle far more than traditional relational data

    Modern PostgreSQL extensions and features allow it to emulate many specialized database capabilities surprisingly well.

  2. Operational simplicity matters

    Running one well-understood database is often significantly simpler than maintaining multiple specialized systems.

  3. Premature specialization can create unnecessary complexity

    It is easy for early-stage AI systems to adopt multiple databases before product requirements genuinely justify them.

  4. Specialized databases still absolutely have their place

    At scale, specialist databases may provide major advantages, but many projects do not need to reach for them immediately.

If you’ve spent time building modern AI systems recently, you’ve probably experienced something like this:

You start with a fairly simple application idea.

Then the architectural recommendations begin.

  • PostgreSQL for relational data
  • MongoDB for documents
  • Pinecone for vectors
  • Neo4j for relationships
  • Redis for memory
  • Elasticsearch for search
  • InfluxDB for metrics
  • Kafka for events

Before long, your “small AI prototype” can start resembling a distributed systems conference.

Complex interconnected systems

Aside

Food for Thought

Sometimes the hardest part of modern software architecture is resisting the urge to build a hyperscale distributed system before you even have users.

Modern infrastructure tooling is incredible, but it also makes architectural overengineering surprisingly accessible.

The interesting thing is that, increasingly, PostgreSQL can often handle a surprisingly large amount of this workload itself.

Not perfectly.

Not always optimally.

But often well enough that introducing multiple specialist databases early on may create more operational complexity than business value.

I think it’s easy to overlook just how capable modern PostgreSQL has become.


The Database Explosion

Modern systems have no shortage of database options. These are only some of them.

Relational Databases

  • PostgreSQL
  • MySQL
  • SQL Server
  • Oracle
  • SQLite

Document Databases

  • MongoDB
  • Couchbase
  • Firestore
  • Cosmos DB
  • DynamoDB

Vector Databases

  • Pinecone
  • Weaviate
  • Qdrant
  • Milvus
  • Chroma

Graph Databases

  • Neo4j
  • JanusGraph
  • ArangoDB
  • Amazon Neptune

Search Engines

  • Elasticsearch
  • OpenSearch
  • Solr

Time-Series Databases

  • InfluxDB
  • TimescaleDB
  • OpenTSDB

Key-Value / In-Memory Databases

  • Redis
  • Memcached
  • Riak

If you’re building modern AI systems, it’s incredibly easy to convince yourself that every single one of these technologies is immediately necessary.

Particularly once terms like:

  • Agent memory
  • Long-term memory
  • Semantic search
  • Knowledge graphs
  • Hybrid retrieval
  • Vector similarity
  • Relationship traversal

…start entering the conversation.

And to be clear, these technologies absolutely exist for good reasons.

But I also think it’s easy for early-stage systems to optimize for scale, specialization, and theoretical future requirements before they’ve validated the actual product.


PostgreSQL Quietly Became Much More Than “Just SQL”

I think one of the biggest misconceptions about PostgreSQL is that it still gets mentally categorized as “a traditional relational database.”

PostgreSQL has evolved significantly beyond that perception.

Modern PostgreSQL is more like an extensible data platform.

PostgreSQL Can Potentially Handle

  • Traditional relational data
  • Document-style storage
  • Vector similarity search
  • Graph-like traversal
  • Full-text search
  • Time-series workloads
  • Geospatial queries
  • JSON querying
Flexible database architecture

Now, obviously, that doesn’t mean PostgreSQL becomes the absolute best tool in the world at every one of these things.

But for many applications, particularly early-stage AI systems, “good enough while operationally simple” is an extremely powerful engineering property.


pgvector Changed the Conversation

Let’s start with the obvious AI-related example.

Vector databases exploded in popularity because embeddings became foundational to modern AI systems.

  • Retrieval-Augmented Generation (RAG)
  • Semantic search
  • Memory systems
  • Similarity matching
  • Recommendation engines

Suddenly, vector search started appearing in a huge number of systems.

And naturally, specialist vector databases appeared to solve the problem.

But then pgvector became increasingly mature.

AI vector search and embeddings

pgvector Allows PostgreSQL To Store

  • Embeddings
  • Vector indexes
  • Similarity search queries
  • Metadata filtering
  • Hybrid structured and semantic retrieval

For many applications, it works remarkably well.

Particularly when paired with the advantages of remaining inside a single transactional database.

  • Simpler infrastructure
  • Simpler backups
  • Simpler local development
  • Simpler deployments
  • Simpler consistency guarantees
  • Simpler observability

That matters more than people might realize.

  • Especially for small teams.
  • Especially for prototypes.
  • Especially for startups still trying to prove product-market fit.

JSONB Quietly Turned PostgreSQL Into a Document Database

Another feature that dramatically changed PostgreSQL’s flexibility is JSONB.

This is the point where PostgreSQL starts becoming extremely attractive for AI workflows.

AI systems often produce awkward, semi-structured data:

  • Tool outputs
  • Agent state
  • Workflow metadata
  • Chat history
  • Evaluation results
  • Dynamic schemas
  • Mixed structured/unstructured payloads

Traditional relational modelling can become painful here.

But JSONB gives PostgreSQL a surprisingly document-database-like capability set.

JSONB Benefits

  • Flexible schemas
  • Nested querying
  • GIN indexes
  • Hybrid relational/document approaches
  • Easier evolution of rapidly changing systems
Structured and unstructured data
  • No, it is not identical to MongoDB.
  • No, it will not necessarily outperform dedicated document databases for all workloads.

But again, many teams do not initially need perfect specialization.

They need reasonable flexibility without operational fragmentation.


PostgreSQL Even Has Graph Extensions

This is probably the section that surprises people the most.

PostgreSQL can even move into graph-style territory through extensions like Apache AGE.

Is PostgreSQL going to outperform Neo4j for deeply graph-centric workloads with highly optimized traversal patterns?

Probably not.

But if your application only has moderate graph requirements, the trade-off becomes more interesting.

For many applications, the requirement is not “internet-scale graph traversal.”

It is simply “store and query relationships reasonably well.”

Because now the question becomes:

Is the operational simplicity of keeping everything in PostgreSQL worth more than the theoretical performance gains of introducing a dedicated graph database?

Sometimes the answer is absolutely yes.

Many applications do not truly need internet-scale graph traversal performance.

They simply need relationships.


Full-Text Search Exists Too

Another thing that’s easy to forget:

PostgreSQL already includes surprisingly capable full-text search functionality.

That does not mean Elasticsearch suddenly becomes obsolete.

Far from it.

But again, for many systems:

  • Moderate search requirements
  • Internal tooling
  • Prototype systems
  • Operational dashboards
  • AI workflow metadata

…PostgreSQL can often provide a perfectly reasonable solution.

Without introducing yet another operational dependency.


The Hidden Cost of Polyglot Persistence

I think this is one of the most underappreciated parts of the discussion.

Every additional database introduces operational complexity.

Confused robot

Every New Database Potentially Introduces

  • New infrastructure
  • New authentication systems
  • New SDKs
  • New backup strategies
  • New deployment concerns
  • New monitoring requirements
  • New scaling considerations
  • New failure modes
  • New operational expertise requirements

One of the biggest operational advantages PostgreSQL has is not technical.

It’s human.

There are a huge number of developers, DBAs, DevOps engineers, platform engineers, and cloud providers already deeply familiar with PostgreSQL.

That matters enormously.

Finding PostgreSQL expertise will generally be easier than finding specialists in:

  • Neo4j
  • Cassandra
  • Pinecone
  • JanusGraph
  • Milvus
  • ArangoDB

And that has real business implications.

  • Hiring
  • Onboarding
  • Operational resilience
  • Knowledge transfer
  • Incident response
  • Long-term maintainability

Sometimes “boring and well understood” is an extremely powerful architectural feature.


Local Development Is Surprisingly Straightforward

This is another area where PostgreSQL quietly shines.

Running PostgreSQL locally is straightforward.

Modern PostgreSQL Setup Is Often

  • A Docker container
  • A Podman container
  • A Railway deployment
  • A Supabase instance
  • A managed cloud service
Simple deployment architecture

Compared to coordinating multiple specialist databases, local development can become dramatically simpler.

That simplicity compounds over time.


This Does Not Mean Specialist Databases Are Bad

To be clear, specialist databases absolutely have their place.

There are plenty of scenarios where dedicated systems become completely justified.

For example:

  • Massive vector workloads
  • Extremely high-scale search
  • Deep graph traversal requirements
  • Huge throughput systems
  • Specialized indexing needs
  • Multi-region scaling requirements
  • Ultra-low-latency workloads

At scale, specialist databases may absolutely outperform PostgreSQL in meaningful ways.

And sometimes dramatically so.

But I also think it’s easy to fall into the trap of reaching for specialization before a project has sufficient operational maturity or user demand to justify it.


Sometimes “Good Enough” Is The Best Engineering Decision

I think this is ultimately the core of the discussion.

Engineers understandably love elegant specialization.

But real-world systems involve trade-offs.

Sometimes the best architecture is not the theoretically perfect one.

Sometimes it’s the one that:

  • The team can operate confidently
  • The business can hire for
  • The infrastructure team can support
  • The developers can deploy easily
  • The organization can reason about
  • The product can evolve rapidly with

PostgreSQL is remarkably good at being that database.


Final Thoughts

I am not suggesting PostgreSQL should replace every specialist database.

That would be ridiculous.

But I do think modern AI architecture discussions can easily underestimate how much PostgreSQL can already do.

Especially in the early stages of a product.

Because once you move beyond architectural diagrams and into real operational environments, simplicity starts becoming extremely valuable.

The benefits are real!

  • One database.
  • One operational model.
  • One deployment target.
  • One set of backups.
  • One talent pool.
  • One ecosystem.
Robot answering a question

In real-world systems, operational simplicity is often far more valuable than theoretical architectural perfection.


Resources

Work with Ian

Need a workflow, pipeline, or copilot built for a real operational use case?

If this post aligns with what you are building, I can help scope the implementation and turn the concept into a production-ready system.