Comment by bigfatkitten

9 months ago

It’s especially easy to waste money on databases.

People just throw more compute power (ie money) at performance problems, rather than fixing their queries or making better use of indices.

You can see this in the article here, where they are just using whatever garbage queries Prisma spits out.

I’ve contended for a long time that ORMs and their ilk automatically building queries is an antipattern for anything but small data scale. At any reasonable size of db, you’re going to need to know sql well enough to write optimized queries anyway. There’s essential complexity in the DB queries, which ORMs can only hide for so long.

And do not consider owning the hardware. See what hardware you can buy for that money.

  • How many servers are needed to bounce back from a server failure in a few minutes? Should we consider 3 VMs instead of 1 physical?

    • Two. Run one in warm/hot standby, optionally with synchronous commits if you want (nearly) guaranteed zero data loss, and can tolerate the increased write latency.

      Technically you’ll need a third server to perform the failover, but it doesn’t need to be nearly as big, as it’s just watching heartbeats and issuing commands.

    • Server failures are rare. Its still usually going to be cheaper to have physical servers even with spare capacity for failures.