By Stephan Schmidt
Just Use Postgres for Everything
How to reduce complexity and move faster
TLDR; just Postgres for everything.
We have invited complexity through the door. But it will not leave as easily.
There is Radical Simplicity though.
One way to simplify your stack and reduce the moving parts, speed up development, lower the risk and deliver more features in your startup is “Use Postgres for everything”. Postgres can replace—up to millions of users—many backend technologies, Kafka, RabbitMQ, Mongo and Redis among them.
This makes every application easier to develop, scale and operate.
Less moving parts means fewer developers for parts that don’t provide value or just replicate existing functionality (frontend) and more developers on parts (like the backend) that does provide value to customers. What if you could increase feature output by 50% without higher costs? For developers: What about a lower cognitive load? You really deeply understand all moving parts? No more imposter syndrome?
Just Use Postgres
- Use Postgres for caching instead of Redis with UNLOGGED tables and TEXT as a JSON data type. Use stored procedures or do as I do, use ChatGPT to write them for you, to add and enforce an expiry date for the data just like in Redis.
- Use Postgres as a message queue with SKIP LOCKED instead of Kafka (if you only need a message queue). Or as a job queue in Go with River
- Use Postgres with Timescale as a data warehouse.
- Use Postgres with pg_analytics as an in memory OLAP with Apache Datafusion
- Use Postgres with JSONB to store Json documents in a database, search and index them - instead of Mongo.
- Use Postgres as a cron demon to take actions at certain times, like sending mails, with pg_cron adding events to a message queue.
- Use Postgres for Geospacial queries.
- Use Postgres for Fulltext Search instead of Elastic.
- Use Postgres to generate JSON in the database, write no server side code and directly give it to the API.
- Use Postgres with auditing with pgaudit
- Use Postgres with a GraphQL adapter to deliver GraphQL if needed.
There I’ve said it, just use Postgres for everything.
No comments:
Post a Comment