by wbercx · 1y ago · 0 comments
What drives this sentiment?
People say 'Facebook uses Mysql', but if a page fails, you just refresh. Most of the time the page is different so if everything is broken in the back end no one cares. Same with ad tracking (I have written code to check impressions via second sources).
If I refresh my bank balance I want to see the same. That's why they use Posgtges (yes the bank I worked on), or some commercial thing like SQLServer or Oracle, where integritry is more highly important.
You seem to be under the impression that MySQL just "fails" on random read queries? That is nonsense.
In reality Facebook's db fleet is a massive sharded system, and sometimes shards are temporarily offline due to hardware failure on the shard's primary/writer node, but it's quite brief in the vast majority of cases. When you have such a massive number of servers, hardware failures happen many times a day.
Due to caching and other services it's also a multi-leveled data access stack, so a page load could fail due to some non-MySQL component having problems as well. Or a network issue, etc. It's not magically MySQL's fault every time something goes wrong at Facebook.
Meta uses MySQL for a variety of mission-critical use-cases, including financial ones. Every single committed MySQL write is replicated before success is returned to the calling code, nothing is lost or thrown away.
> Things that are missing in most other proper databases, like transactional DDL [...]
> some commercial thing like SQLServer or Oracle, where integritry is more highly important.
And yet Oracle DBMS does not have transactional DDL either, so why aren't you equally critical of it here?
In modern MySQL, DDL is atomic and crash-safe on a per-statement basis. It's just not "transactional", in the sense that you can't combine multiple DDL statements (nor mix DDL and DML) into a single transaction.
See https://dev.mysql.com/doc/refman/8.0/en/atomic-ddl.html for reference.
Modern versions of MariaDB also have atomic DDL, although their underlying implementation is quite different.
And even in older versions of MySQL and MariaDB, an ALTER TABLE which causes an integrity violation was still rolled back. Think about it: the only possible non-instantaneous integrity violations are when adding a new unique key, new foreign key, or new check constraint. Check constraints didn't exist in old versions of MySQL or MariaDB, so that just leaves unique keys and foreign keys. And there's no notion of a "partially populated" index or a "half applied" foreign key constraint in MySQL, so your assertion of the ALTER just "stopping" mid-stream without rollback is just plain wrong.
A quick search hints me that there is still more ultra-large MySQL setups than there are PostgreSQL. By a large margin it seems.
Between easier upgrades/HA, thread connection model, Vitess and engines like MyRocks, it's hard to beat for many use cases.
MySQL is fine, boring tech that powers a great many companies. There's nothing wrong with choosing it for a new venture, but there's also nothing wrong with another choice. Which RDBMS you use won't be the deciding factor in your success these days.
It's waaaay more quirky in our experience.
Also: Oracle hate is not unwarranted, even in this day-and-age.
> There's nothing wrong with choosing it for a new venture
I'd advise anyone in that position not to choose MySQL. Go with Postgres unless you have a good reason not to.
I find myself having to STRAIGHT_JOIN more often than I would like because it simply won’t generate sensible execution plans sometimes.
* sub-query needs to be wrapped in a sub-query
* we had an issue recently (dont have the link at hand) where mysql team closed the bug as fixed but only documented it as a "know issue". we had to split up one query in 5 queries to fix this
* ask Lucas Eder what is a better db, he has intimate experience with all of 'm
Here are some we also run into:
https://www.codementor.io/@goetas/why-i-prefer-postgresql-to...
The fun thing is MySQL will also require schema migration tooling, but since their native migrations are so bad the tooling around it has evolved to be much better. Things like pt-osc and gh-ost will kick the butt of anything Postgres has, let alone when you pull out the big boy tools with Vitess.
Don't get me wrong, most databases will never need such tooling whether they're Postgres or MySQL. But still I find it interesting that (for the migration story at least) at small scale they're equal, then at medium scale Postgres wins out and at larger scales MySQL starts to win again.
Unless you need the kind of sophisticated extensions Postgres supports MySQL is likely to be a good fit. The query planner is straightforward, performance tuning slightly more predictable and easy compared to Postgres.
What are you referring to here?
When people talk about bad defaults in old MySQL, they're typically referring to lack of strict sql_mode by default prior to MySQL 5.7 (2015). They're not talking about OS users.
I've been using MySQL for 22 years and your comment about sudo bears no resemblance to anything I've ever experienced.
PHP is also something I'd not advise anyone to use on a greenfield app unless you have really good reasons for doing so.
There are much better --also very conservative-- stacks available for free (and no, those are not JS based).
For instance: Kotlin, http4k, JTE/KTE (or kotlinx.html), SQLDelight, Postgress.
Big shops with big legacy PHP code bases all move away from it.
LAMP = Linux (sure), Apache (no-way, use NGINX or in app web server instead), MySQL (sorry, Postgres won) and PHP/Perl (these langs are going the way of the Dodo).
So LAMP is a bad choice nowadays. I'd say it has been since Ruby on Rails 1.0.
https://github.com/WalkerCodeRanger/ExhaustiveMatching
I prefer languages that have been designed with this in mind. Kotlin in this case goes a long way.
Golang is shit IHMO. No null-safety. No sum types. I dont know what Rob Pike was thinking when he designed this. Total disregard for the last 40 years of innovation in software engineering. Sad.