Sal's

On self-managing Postgres

Pierce Freeman wrote a blog post, Go ahead, self-host Postgres, which sparked lively discussions on Hacker News and Lobste.rs.

Pierce says:

I'd argue self-hosting is the right choice for basically everyone, with the few exceptions at both ends of the extreme.

I have a different opinion based on my experience as a manager of engineering teams across multiple companies. My teams have owned lots of databases, including lots of Postgres. As the manager, I was responsible for staffing the team with the right people and skillsets to keep everything humming along, which has shaped my perspective.

In my view, it’s not about the burden on you to get something like Postgres running, keep it reasonably maintained, automate deployment and maintenance, get minimum-viable backups working, etc. It’s not about you, the individual. Rather, it’s about the enduring team, business continuity, and the cost of downtime.

Sure, you, the individual, got everything running perfectly, and all your cool scripts mean that you, the individual, spend just minutes per month on maintenance. But what happens when you’re not around? Suppose you get hit by a bus, leave the company, go camping off the grid, or just forget to bring your work laptop out to date night when you’re on call.

At any sizable business that lasts long enough, there will come a day when someone else needs to figure out your shit, perhaps under duress during a production outage, with angry customers piling up and senior leadership breathing down necks. What happens then?

The list goes on and on, and it scales in length with the complexity and criticality of your rig.

Do you have read replicas? More docs, more playbooks, more testing.

Some sort of HA? More.

Are you running PgBouncer? More.

Are you managing clusters of instances and replication? More.

Do you have multiple data centers for redundancy? More, my friend! More!

Next topic: When was the last time you tried to hire someone with strong expertise in low-level database administration? For me, it wasn’t very long ago. My company was well known, had a good culture, paid above market rate ($150-300K depending on seniority and location), and it was still really fucking hard to find good people. It was similarly difficult to train up junior members of the team due to the magnitude of complexity and cost of mistakes. That scared me perhaps more than anything else.

Folks are quick to point that that managed services don’t magically solve all these problems. There’s still downtime and complexity, and you still need to hire engineers to manage stuff. Sure, yep, of course. But managed services do solve or at least mitigate a lot of problems:

This debate will go on endlessly. I’m biased, clearly, and I don’t claim to be correct in any absolute sense. There are far too many factors and nuances at play. But I do know that, for my day job, I want to stay well away from infrastructure teams who are self-managing this stuff. Been there, done that, have the scars, don’t want any more. 😅

#postgres #self-hosting