Live data from Hacker News

Why Uber Engineering Switched from Postgres to MySQL (2016)

eng.uber.com

51–60 of 133 posts

Re: Why Uber Engineering Switched from Postgres to MySQL (2016)

#51
post #19

I spent a whole decade saying "Why do I need Postgres? MySQL is fine." Started using Postgres a couple of years ago, and I now can't believe I ever lived without window functions, native arrays, custom types, etc.

Postgres was my first, and the Postgres docs were foundational for someone like me.

Tried MySQL a couple years later, and every day I used it I found a new reason to never use it again.

Re: Why Uber Engineering Switched from Postgres to MySQL (2016)

#52
post #48
post #19

I spent a whole decade saying "Why do I need Postgres? MySQL is fine." Started using Postgres a couple of years ago, and I now can't believe I ever lived without window functions, native arrays, custom types, etc.

Arrays in Postgres are my guilty pleasure. I know I shouldn’t use them but I just cannot help myself.

They’re great for denormalisation, which is often an appropriate trade off.

Re: Why Uber Engineering Switched from Postgres to MySQL (2016)

#53
post #8

Earlier quoted context omitted.

Define: "complicated"

PostgreSQL: "your date 2020-02-31 isn't a date, fix that" MySQL: "2020-02-31? Whatever man, I'll just enter something..."

The mysql behavior terrifies me because eventually you're going to end up with something you didn't expect and it's going to be a pain in the butt to track it down.

Re: Why Uber Engineering Switched from Postgres to MySQL (2016)

#54
post #19

I spent a whole decade saying "Why do I need Postgres? MySQL is fine." Started using Postgres a couple of years ago, and I now can't believe I ever lived without window functions, native arrays, custom types, etc.

The best part is transactional ddl statements. You can do your database migration in a transaction, if something fails the transaction is rolled back compared to an invalid state with mysql.

Re: Why Uber Engineering Switched from Postgres to MySQL (2016)

#55

Earlier quoted context omitted.

It would be great if there was some management GUI for these tasks so you don’t have to look up the syntax for these things that in many deployments you only do once.

pgadmin ;-P

This actually looks pretty reasonable, I am going to look into it. First I need to figure out how to open up the server for connections but still limit it, though.

Re: Why Uber Engineering Switched from Postgres to MySQL (2016)

#56
post #7

Earlier quoted context omitted.

Define: "complicated"

Just creating a new user is annoying enough. Permissions are also much more complex. What the hell are schemas?

What MySQL calls databases are actually schemas. They’re even aliases as such.

MySQL doesn’t have multiple SQL databases, you’ve been using multiple schemas.

Re: Why Uber Engineering Switched from Postgres to MySQL (2016)

#57
post #48

Earlier quoted context omitted.

Arrays in Postgres are my guilty pleasure. I know I shouldn’t use them but I just cannot help myself.

They’re great for denormalisation, which is often an appropriate trade off.

Even storing JSON blobs isn’t the hit it used to be. It’s not relational, but you can index on fields in the JSON and query it effectively. The Postgres array and other types are great for stuff at the edges of your database or when you know you won’t need to build relations into or on that data. RDBMS like Postgres really provide a powerful, powerful technology for managing data.

Re: Why Uber Engineering Switched from Postgres to MySQL (2016)

#58
post #16

Earlier quoted context omitted.

Sure, but it does not really matter. Uber has not switched from Postgres used as RDBMS to MySQL used as RDBMS , they switched from Postgres used as RDBMS to MySQL used as key-value storage layer of homegrown sharded non-relational database . This has pretty much no bearing on anyone using Postgres or MySQL in reasonable way.

Exactly. I think the prior HN discussions failed to call out how painful it is to do any sort of schema migration against a big InnoDB table [1][2]. Well known MySQL uses such as Facebook TAO and this Uber Schemaless are typically abstractions built on top of MySQL, which means the schemas are pretty much static, and they don't feel the schema migration pain. For a typical RoR startup that relies on a RDBMS, please,…

FB had plenty of schema changes. I know, I wrote software to push them out. The important concepts for pushing schema at scale became part of Skeema.

Re: Why Uber Engineering Switched from Postgres to MySQL (2016)

#59
post #36
post #12

Earlier quoted context omitted.

Agreed. As with strong typing in programming languages, I do prefer a database to be strict in rejecting invalid inputs. MySQL does two bad things here: It accepts an invalid input plus it interprets it creatively, producing something the user most probably didn't intend. In that respect, MySQL is almost as bad as Excel creatively "interpreting" dates. Another example of a database doing improper things would be Orac…

https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sql-mo... Much of your MySQL complaint is not a MySQL issue, but a config issue. And yes, powerful config options are good, not bad.

One can still complain about mysqls dumb defaults.

https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.ht...

"Hey, let's just not act transactional on a timeout by default"

Re: Why Uber Engineering Switched from Postgres to MySQL (2016)

#60
post #47
post #12

Earlier quoted context omitted.

Agreed. As with strong typing in programming languages, I do prefer a database to be strict in rejecting invalid inputs. MySQL does two bad things here: It accepts an invalid input plus it interprets it creatively, producing something the user most probably didn't intend. In that respect, MySQL is almost as bad as Excel creatively "interpreting" dates. Another example of a database doing improper things would be Orac…

utf8mb3 isn't a broken subset. It includes characters in the basic multilingual plane which is fine for 99% of cases. uft8mb4 uses more bytes than necessary for most. You get 255 varchar limits with uft8mb3, I think you only get 192 characters with uft8mb4.

uft8mb4 does not use more bytes than utf8mb3, for anything representable by utf8mb3 the size in uft8mb4 is identical. Anything that would be 4 bytes in uft8mb4 is not able to be stored in utf8mb3

utf8mb3 is definitely a broken subset, it's deprecated at the very least

Post reply on HN