lunes, 23 de octubre de 2023

Just use Postgres for everything!

 Just discovered this post https://www.amazingcto.com/postgres-for-everything/ which is short, and to the point.

Copying it verbatim, because it deserves to be read even if you don't click my links

"

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.


Use Postgres for caching instead of Redis with UNLOGGED tables and TEXT as a JSON data type. Use stored procedures 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).


Use Postgres with Timescale as a data warehouse.


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 a GraphQL adapter to deliver GraphQL if needed.


There I’ve said it, just use Postgres for everything.

"


Also, there's a link to radical simplicity, which seems like another iteration of use-boring-technology.

This one is also great gist about using pg for basically everything https://gist.github.com/cpursley/c8fb81fe8a7e5df038158bdfe0f06dbb

lunes, 2 de octubre de 2023

Idempotency is so great

Once I'm presented with a problem, there are a few angles I instantly look at it, to get a shape of which kinds of solutions might work, and whether the problem allows for unknowns as I go, or it has to be right.

- One of them is idempotency. 

- Another is "does it allow for layered development/deployment?". Can I keep figuring out the rest of the owl as I'm drawing it?

- Steel thread vs gaining resolution as we go through

I remember Christopher Alexander's

The difference between the novice and the master is simply that the novice has not learnt, yet, how to do things in such a way that he can afford to make small mistakes. The master knows that the sequence of his actions will always allow him to cover his mistakes a little further down the line. It is this simple but essential knowledge which gives the work of a master carpenter its wonderful, smooth, relaxed, and almost unconcerned simplicity.

https://ericlathrop.com/2021/04/idempotence-now-prevents-pain-later/

https://news.ycombinator.com/item?id=31027403

https://www.berkansasmaz.com/every-programmer-should-know-idempotency/

https://newsletter.casewhen.xyz/p/data-explained-idempotence

https://www.youtube.com/watch?v=GRr4xeMn1uU

https://danluu.com/simple-architectures/ (links to some brandur posts about idempotency and jobs)