Live data from Hacker News

Go ahead, self-host Postgres

pierce.dev

301–310 of 407 posts

Re: Go ahead, self-host Postgres

#301
post #28

The author brings up the point, but I have always found surprising how much more expensive managed databases are than a comparable VPS. I would expect a little bit more as a cost of the convenience, but in my experience it's generally multiple times the expense. It's wild. This has kept me away from managed databases in all but my largest projects.

Yes if the DB is 5x the VM and the the VM is 10x the dedicated server from say OVH etc. then you are payng 50x.

Re: Go ahead, self-host Postgres

#302
> I sleep just fine at night thank you.

I also self-host my webapp for 4+ years. never have any trouble with databases.

pg_basebackup and wal archiving work wonder. and since I always pull the database (the backup version) for local development, the backup is constantly verified, too.

Re: Go ahead, self-host Postgres

#303
post #36

> I'd argue self-hosting is the right choice for basically everyone, with the few exceptions at both ends of the extreme: > If you're just starting out in software & want to get something working quickly with vibe coding, it's easier to treat Postgres as just another remote API that you can call from your single deployed app > If you're a really big company and are reaching the scale where you need trained database e…

I also encourage people to just use managed databases. After all, it is easy to replace such people. Heck actually you can fire all of them and replace the demand with genAI nowadays.

Re: Go ahead, self-host Postgres

#304

I don't feel like it's easy to self-host postgres. Here are my gripes: 1. Backups are super-important. Losing production data just is not an option. Postgres offers pgdump which is not appropriate tool, so you should set up WAL archiving or something like that. This is complicated to do right. 2. Horizontal scalability with read replicas is hard to implement. 3. Tuning various postgres parameters is not a trivial tas…

"all scripts and memory to look back. But otherwise it's hard. Clicking few buttons in hoster panel is much easier."

so we need open source way to do that, coolify/dokploy comes to mind and it exactly do that way

I would say 80% of your point wouldnt be hit at certain scale, as most application grows and therefore outgrow your tech stack. you would replace them anyway at some point

Re: Go ahead, self-host Postgres

#305

I have ran (read: helped with infrastructure) a small production service using PSQL for 6 years, with up to hundreds of users per day. PSQL has been the problem exactly once, and it was because we ran out of disk space. Proper monitoring (duh) and a little VACUUM would have solved it. Later I ran a v2 of that service on k8s. The architecture also changed a lot, hosting many smaller servers sharing the same psql serve…

But it’s 1500 pages long!

Good point. I sure didn't read it myself :D

I generally read the parts I think I need, based on what I read elsewhere like Stackoverflow and blog posts. Usually the real docs are better than some random person's SO comment. I feel that's sufficient?

Re: Go ahead, self-host Postgres

#306

I don't feel like it's easy to self-host postgres. Here are my gripes: 1. Backups are super-important. Losing production data just is not an option. Postgres offers pgdump which is not appropriate tool, so you should set up WAL archiving or something like that. This is complicated to do right. 2. Horizontal scalability with read replicas is hard to implement. 3. Tuning various postgres parameters is not a trivial tas…

wal archiving is piss easy. you can also just use basebackup. with postgres 17 it is easier than ever with incremental backup feature.

you don't need horizontal scalability when a single server can have 384 cpu real cores, 6TB of ram, some petabytes of pcie5 ssd, 100Gbps NIC.

for tuning postgres parameters, you can start by using pgtune.leopard.in.ua or pgconfig.org.

upgrading major version is piss easy since postgres 10 or so. just a single command.

you do not need pgbouncer if your database adapter library already provide the database pool functionality (most of them do).

for me maintained database also need that same amount of effort, due to shitty documents and garbage user interfaces (all aws, gcp or azure is the same), not to mention they change all the time.

Re: Go ahead, self-host Postgres

#307
Self-hosting Postgres is so incredibly easy. People are under this strange spell that they need to use an ORM or always reach for SQLite when it’s trivially easy to write raw SQL. The syntax was designed so lithium’d out secretaries were able to write queries on a punchcard. Postgres has so many nice lil features.

Re: Go ahead, self-host Postgres

#309

Earlier quoted context omitted.

Er… what? Even in today’s world with Docker, you have differences between dev and prod. For a start, one is accessed via the internet and requires TLS configs to work correctly. The other is accessed via localhost.

Just fyi, you can put whatever you want in /etc/hosts, it gets hit before the resolver. So you can run your website on localhost with your regular host name over https.

I’m aware, I just picked one example but there are others like instead of a mail server you’re using console, or you have a CDN.

Re: Go ahead, self-host Postgres

#310

Earlier quoted context omitted.

It's even worse when you start finding you're staffing specialized skills. You have the Postgres person, and they're not quite busy enough, but nobody else wants to do what they do. But then you have an issue while they're on vacation, and that's a problem. Now I have a critical service but with a bus factor problem. So now I staff two people who are now not very busy at all. One is a bit ambitious and is tired of be…

This would be a strange scenario because why would you keep these people employed? If someone doesn't want to do the job required, including servicing Postgres, then they wouldn't be with me any longer, I'll find someone who does.

No doubt. Reading this thread leads me to believe that almost no one wants to take responsibility for anything anymore, even hiring the right people. Why even hire someone who isn't going to take responsibility for their work and be part of a team? If an org is worried about the "bus factor" they are probably not hiring the right people and/or the org management has poor team building skills.
Post reply on HN