Postgres is not a database.


Postgres is not a database.

For years, we’ve been taught to see Postgres as the reliable, open source workhorse for storing our data.
Everyone called it "The Toyota of databases", you know... it just works.
But to leave it at that is to miss the whole story.
Postgres isn’t just a place to put your data, it’s a powerful development platform that can become the core of your entire backend, an operating system (yea, bold) for your application’s stack.

Diving deep into its capabilities I learned that Postgres was built with extensibility at its heart.
This means that with a few commands, you can bolt on new powers that allow it to replace dedicated, single purpose tools you’re likely paying for and maintaining right now.
Think of your cache (redis), your message broker (rabbit / kafka), your search engine (elastic), and even your job scheduler.
Postgres can do all of that, and often, it can do it without adding a single new server to your stack.

The most practical way to put this into action is to change your mindset.
The next time you think, “I need a message queue for this feature,” your first question shouldn’t be, “Should we use RabbitMQ or SQS?” but rather “Can Postgres handle this?”
More often than not, the answer is yes.
Now, let's hit the breaks for a second.
No, I'm not claiming Postgres does all of these better.
I'm saying it does it, well enough, to go a long, long way, until you actually need something else.
By starting small and replacing one piece of your stack at a time, you can drastically simplify your architecture, reduce operational overhead, and move faster.

So, what’s the big problem we’re all facing?
Modern application development has led to backend sprawl.
It's FOMO-driven development.
To build a feature rich application, you’re told you need a whole suite of specialized tools.
Your shopping cart looks something like this: a primary database (Postgres), a caching layer (Redis), a message queue for background jobs (RabbitMQ), a real-time notification system (maybe also Redis pub/sub), and a powerful search engine (Elasticsearch).
And this is without even mentioning your cloud platform and the plethora of services they offer for these tools, either directly managed, or a competition of some sort.
Your architecture diagram starts to look like a complex web of interconnected services.

The default solution for most developers is to spin up a new service for each new problem. It’s the “best tool for the job” philosophy.

But it can be different.

This is where we can solve the problem differently by leaning into the full power of Postgres.
Instead of building outwards, we build inwards, consolidating our stack directly within the database we already trust, as much as possible.

  • Replacing your Cache (like Redis): Postgres has UNLOGGED tables.
    These tables don’t write to the standard transaction log (WAL), making them incredibly fast for temporary data, perfect for a cache.
    Pair this with the pg_cron extension to run a simple cleanup procedure every hour, and you’ve just built a TTL cache inside Postgres, no Redis required.
  • Replacing your Pub/Sub and Message Queue (like RabbitMQ or SQS): For simple, real-time notifications, Postgres has built in LISTEN and NOTIFY commands. For more robust, persistent queuing, the pgmq extension gives you a lightweight message queue with an API that’s compatible with AWS SQS, making it incredibly powerful for background jobs.
  • Replacing your Document Database (like MongoDB): Do you need to store unstructured data? The native JSONB data type is a game-changer. It stores your JSON as a decomposed binary format that is fully indexed and queryable.
    You can query nested fields, check for the existence of keys, and get the flexibility of a NoSQL database without adding another system.
  • Replacing Specialized Data Stores: The ecosystem of extensions is where Postgres truly shines and becomes a platform:
    • Geospatial Data: The PostGIS extension turns your database into a full-featured geospatial server, allowing you to store coordinates and run complex location-based queries, like finding the closest coffee shop.
    • Vector Search for AI: With the rise of AI, everyone needs a vector database. The pgvector extension lets you store and query embeddings right next to your application data.
    • Time-Series Data (like Elasticsearch): Extensions like TimescaleDB transform Postgres into a high-performance time-series database, perfect for analytics, IoT, and monitoring workloads.

By leveraging these features and extensions, you can shrink your backend from five or six disparate services into one robust, reliable, and battle-tested platform: Postgres.

I hope this was valuable!

Feel free to reply directly with any question or feedback.
Thank you for reading.

Have a great weekend!

ESPRESSO FRIDAYS

Every once in a while I send hand picked things I've learned. Kind of like your filter to the tech internet. No spam, I promise!

Read more from ESPRESSO FRIDAYS

How I Setup Terminal On My Mac To Make It Amazing I often get asked about my "terminal setup", and I try to throw tips but it's never enough. This answer took a long time to compile but I'm glad to share it: A terminal setup from scratch (literal white screen terminal) to multiplexing, color output, auto-completion, history manager, fonts, nerd fonts etc etc etc... I learned that the journey to a “perfect” terminal setup is a personal one, built from years of small, incremental improvements....

The Unreasonable Effectiveness of 12-Factor Apps This issue is brought to you by: Twingate: It's time to ditch your VPN. Keep private resources and internet traffic protected with Zero Trust security tools built for the modern world of work. Start securing your Kubernetes clusters today! The title of this newsletter isn’t just fluff; it points to a fundamental truth in software development. Often, the most expensive problems stem from ignoring a few simple, foundational rules. The...

Custom computer build with blue led lighting

FFmpeg Converts ANYTHING - The Trick Book I Wish I Had This issue is brought to you by: Learn backend development the smart way with boot.dev Use the code DEVOPSTOOLBOX to get 25% off your first payment for boot.dev. Get Started Today The title of this newsletter isn't an exaggeration. There's a single, free tool that can genuinely convert, create, and manipulate almost any media file you throw at it. It’s the hidden engine powering everything from YouTube, through OBS, online media...