by samlambert · 3y ago · 0 comments
Can you explain why the dozens or so Postgres scale up solutions don’t use real Postgres?
Or why anyone at scale with Postgres migrates away?
https://www.uber.com/en-US/blog/postgres-to-mysql-migration/
This outage would have been a lot less likely with MySQL because of redo logs which MySQL has had for a decade. But Postgres replication is under developed. https://about.gitlab.com/blog/2017/02/10/postmortem-of-datab...
Facebook has evaluated every database on the planet and still uses MySQL. https://engineering.fb.com/2021/07/22/core-infra/mysql/
When MySQL has more users, can scale significantly more, runs some of the largest sites on earth, and even lends its storage engine to other databases like Dynamo you should backup your claims that Postgres is technically superior. Please.
But I agree that MySQL is easier to use at high scale for its superior replication story, 3rd party tooling, and pragmatism. If you’ve only run small Postgres you don’t know the fear of the query planner suddenly going AWOL at 3am, or needing to shard your database under duress as you watch the Postgres transaction ID stick closer and closer to overflow because VACUUM won’t finish. You haven’t needed to stress out about the super low practical connection limit and build a cluster of Postgres proxies using PGBouncer or similar.
Related blog post by a teammate: https://www.notion.so/blog/sharding-postgres-at-notion
Also note that folks aren’t running giant vanilla MySQL clusters. They’re running it through vitess or home grown tools with similar functionality.
Finally MySQL gets performance in these large setups by turning off features like foreign keys, acid guarantees etc. it’s awesome and powerful that you can do this in MySQL but it’s not apples to apples here. MySQL has also improved a lot on these dimensions in the last few years.
The other reality here is that on nvme hardware with a few tb of ram you can get away with a basic reader writer replica setup for a long time.
I was at GitHub in 2017 when that GitLab outage happened. We had 60 million users running on vanilla MySQL no Vitess at that point. We had 10 million users literally running on 3 MySQL servers. Don't pretend that even now Postgres can do that.
However, you can absolutely run that many users on a Postgres cluster of that size today on modern hardware. Connections are absolutely a sore point and probably my number one pain point as a Postgres admin day to day. Pg bouncer is incredibly easy to run though. You rarely actually need 70,000 connections most will be idle most of the time anyway it’s not like MySQL can actually serve 70,000 queries on 70,000 connections simultaneously. But it certainly makes administration and the programming model more difficult.
If you knew enough to switch to innodb and "mysql_real_utf8_string" or whatever it was, you had a quite performant and stable system.
The gap has for sure closed in many areas but I still feel safer with Postgres today because there's been little reason for me to try MySQL again.
Large MySQL users are generally not turning off acid guarantees. That is nonsense. What settings are you even specifically referring to with this?
On the durability side, large MySQL shops only mess with innodb_flush_log_at_trx_commit if there's a safe distributed durability mechanism in use (e.g. synchronous or semi-synchronous replication). Or perhaps if the data is ephemeral/recomputable, but that's a similar use-case to running Postgres on a ramdisk.
On the isolation side, MySQL supports READ UNCOMMITTED (unlike Postgres) but it is very rarely used. Only useful for some specific situations. fwiw MS SQL Server supports it too, it's not a MySQL specific thing.
facebook was build using pho mysql since start, by the time they have billion dollar valuation 8ts too late for them to change.
Not to mention no technical reasoning is given at all, so yes take the article with a grain of salt.
MySQL has multiple edge cases where things on the master will not happen on the slave depending on which replication method you've selected and which features you're using. MySQL is the issue here.