Just Use Postgres
45 points by amattn
45 points by amattn
interesting to see how we went from postgres vs mysql to just use postgres over last 20 years
I love postgres, it has been an absolute killer for every project I did
I'd also love to see articles "just use sqlite" because both are awesome!
I wish more people would take SQLite seriously and take advantage of it for simplified deployment of low-usage services. I was recently setting up a self-hosted service and felt frustrated when I found out it required a separate container with MariaDB, especially since I imagine that most deployments aren't being used by more than a handful of users.
I take SQLite seriously, and do use it, even in production, for some things. However, I've been bit by subtle differences between SQLite and postgres behavior a few times.
So if I think that postgres is my best bet for deploying anywhere for a particular application, I'm using it everywhere, even on my one-person dev installation. Adding postgres to my small deployments is easier than figuring out why a few numbers turn out wrong due to subtle differences in the interaction between my ORM and (SQLite vs Postgres).
From a user POV, I fully agree. And the difference in faff between an all-in-one container and needing orchestration (even docker compose) is huge.
But from a dev POV, SQLite basically leaves a lot of lock management to the application (relative to MySQL or Postgres) and that’s a major pain IMHO. If I wanted to get a thing up and going and focus on the application logic I’d resent having to manage that stuff as well.
If we have a “just use sqlite” article I would appreciate guidance on how to fix the defaults and how to transition to high availability.
"PRAGMA foreign_keys=ON;"
"PRAGMA journal_mode = WAL;"
"PRAGMA synchronous = NORMAL;"
"PRAGMA busy_timeout = 5000;"
"PRAGMA temp_store = MEMORY;"
"PRAGMA mmap_size = 134217728;"
"PRAGMA journal_size_limit = 67108864;"
"PRAGMA cache_size = 2000;"
also turn on immediate mode so the busy_timeout works.
Sources:
I have been seeing a lot of these lately. This is my favorite: https://youjustneedpostgres.com/