System resources used when using Elixir with MySQL vs PostgreSQL

Their documentation?

And for super simple generator of config that will be “ok enough” you can use PgTune and you can read PG Wiki on tuning.

Also check out this article - Elixir and Postgres: A Rarely Mentioned Problem | Lainblog

6 Likes

Interesting post. Looks like that could be a super annoying bottleneck to try and track down if it hit you.

Consider sqlite then? You won’t need a separate DB server, everything happens right there inside your app, no network connections to DBs. You will only have 1 server – your Elixir application server. You will not have a separate DB server.


As a broader reply to your scaling problems, others are correct. You will hit 1000 other problems before your choice of DB really starts to matter. And let’s be honest here, most businesses never get to that scale.

That, plus modern DBs like PostgreSQL and MySQL have decades of development behind them and are extremely efficient. You should worry how efficient your Elixir code is instead. :slight_smile: And even then, don’t concern yourself with this before your application server starts lagging.

To expand on – and explain in more details – on what @hauleth said: do NOT pick technologies based on which huge company is using them! Reason: they have very specific problems and they have to micromanage their technology choices to hell and back because for them that might mean the difference between paying for 100 servers or 2000 servers, e.g. they might end up paying non-trivial amounts of cash if they misstep. You don’t have that problem.

Don’t pay attention to what Google / Netflix / Amazon / Microsoft / Apple / Uber etc. use. They use those technologies because they solve a very specific problem for them.

Any normal smaller business is very likely to severely shoot themselves in the foot if they just blindly follow a corporation’s tech choices.

And finally, deciding between using PostgreSQL or MySQL is 99% irrelevant because you’re very likely to pick a managed DB instance a la Amazon’s RDS or DigitalOcean’s DB droplets where the pricing completely hides any underlying performance differences like CPU or I/O or RAM usage. Chances are, you will still pay at least $25 a month no matter which DB you pick.


A piece of advice: don’t agonize over such details because even though they might seem important in your head, in practice these details will be trivialized and hidden from you almost everywhere you go (I mean the hosted solutions). Those toy problems are fun to think about when you are a hobbyist – but if you want to make an actual business you should stick to the well-trodden and beaten paths because that hugely increases your chances to get support from the community as you progress with your code. In Elixir’s case, definitely stick with PostgreSQL because that’s Ecto’s first class DB citizen.

But again, for what you describe, it seems that sqlite might actually be the best choice.

5 Likes