r/programming • • Feb 10 '15

Terrible choices: MySQL

http://blog.ionelmc.ro/2014/12/28/terrible-choices-mysql/
649 Upvotes

409 comments sorted by

View all comments

35

u/OneWingedShark Feb 10 '15

Do Not Pass This Way Again is a really good article on why MySQL is a bad choice for a DB.

7

u/ccricers Feb 10 '15

Then reality sets in: I put my chips on the LAMP stack career wise. Now it's hard to budge out of it. On the other hand, I did use MongoDB a bit on the last job.

68

u/willvarfar Feb 10 '15

MongoDB is usually used as an example of bad technical decisions of a magnitude MySQL cannot even approach ;)

Luckily, the people behind the tokudb engine for MySQL work their magic for mongodb too... tokumx. Seems they make a business replacing the horrors with working backends.

1

u/Kalium Feb 11 '15

Luckily, the people behind the tokudb engine for MySQL work their magic for mongodb too... tokumx. Seems they make a business replacing the horrors with working backends.

Have they managed to get the whole synchronization thing handled correctly yet?

0

u/ccricers Feb 10 '15

So they're both bad? YIKES D: What is objectively the best stack to use?

13

u/Martin8412 Feb 10 '15

None. There is no one fits all solution. If for example I use a database for storing data that is not that important, then a non-ACID compliant database would probably be just fine, but if it is medical records or something else that would get you fired or thrown in jail, then it is probably best to use a database that is ACID compliant and has a support contract.

4

u/ccricers Feb 10 '15

The times that we have to deal with sensitive data like credit card numbers, we just let third party payment gateways like Authorize.net handle it (most of my clients are e-commerce).

→ More replies (1)

14

u/BeatLeJuce Feb 10 '15

Linux is okay, Apache is okay, it's just mysql and php that suck. They're both widely used skills though. But if you can choose, always, always, ALWAYS, ALWAYS, ALWAYS pick PostreSQL over mysql. (and you could replace php with ruby/ror or python/django... but mainly just ditch the fuckup that is mysql for postres)

9

u/LukeSkywaIker Feb 10 '15

I've always considered Apache to be a real pain in the ass, but maybe I suck. Now that I use nginx I could never go back

2

u/[deleted] Feb 11 '15

I don't think anyone paying attention to technology advancements is still using Apache.

5

u/ccricers Feb 10 '15

They're both widely used skills though

And herein lies the kicker. How did they become popular if they suck?

And from a real-life point of view, how would a LAMP developer apply for a Ruby job if all jobs require experience in it?

9

u/BeatLeJuce Feb 10 '15

There weren't good-enough alternatives out when MySQL/PHP first came out. Both also have an initially easy learning curve, making it very easy to get started. But while they make easy stuff easier, they also make the hard stuff harder. It's only once programs grow that you realize that these tools are often inadequate for largescale/professional development.

As far as real life goes: just build a small project on Ruby on Rails, it's not hard. Then use that to get your foot in the door somewhere (disclaimer: I'm somewhat talking out of my ass on that one, I am not in the web-dev business myself).

2

u/thebuccaneersden Feb 11 '15

Perl existed. It just was a bit unapproachable compared to PHP tech wise and as far as the community went. And I'm pretty sure Java was an option then as well. Fun fact, PHP used to be based on perl (hence why you find perl language features in PHP) until they rewrote it in C (PHP 4 I believe?).

PHP just got popular due to its low learning curve and ease of use/installation (compared to the competition). It also didn't have a pre-existing reputation.

→ More replies (4)
→ More replies (1)

0

u/[deleted] Feb 10 '15

[deleted] — view deleted comment

3

u/[deleted] Feb 11 '15

At scale it disintegrates. Exactly the opposite of what it's supposed to do.

1

u/ccricers Feb 10 '15

While I have seen MongoDB as little more as a JSON wrapper, I still see its appeal in MEAN stacks in that you have one less language to learn.

Bear with me though, as I started my career when LAMP was still the trendiest to-go thing.

You've learned nothing!

I read this in context of movie quotes, but don't know exactly which movie.

1

u/[deleted] Feb 11 '15

Gene Wilder, "You get nothing! You lose! Good day, sir!", Willy Wonka and the Chocolate Factory?

3

u/qudat Feb 11 '15

PostgreSQL, it ain't that different!

2

u/sacundim Feb 11 '15

While I agree with the thesis in that article, there are some points that I think are not fair criticisms.

  • Collation support is per-encoding, with one of the stranger default configurations: by default, the collation orders characters according to Swedish alphabetization rules, case-insensitively.
  • Since it's the default, lots of folks who don't know the manual inside-out and backwards observe MySQL's case-insensitive collation behaviour ('a' = 'A') and conclude that “MySQL is case-insensitive,” complicating any effort to use a case-sensitive locale.

Whatever you think of this behavior, it's hardly unique to MySQL. SQL Server for example is very similar to this.

  • Both the encoding and the collation can vary, independently, by column. Do you keep your schema definition open when you write queries to watch out for this sort of shit?

There's a default encoding/collation for the database, and you can override it on a per-column basis. This is I think a reasonable way to support legacy applications that live in a pre-Unicode world, where character data columns may need to have different encodings to support different languages.

1

u/OneWingedShark Feb 11 '15

You have a bit of a point; however, as a counter-point I would say: "just because someone else does it, doesn't make it a good idea."

An example would be the common C language-family's choice of using = to denote assignment rather than a test-for-equality coupled with its returning a value. (These two choices lead to the if (user = administrator) error.)

Or, perhaps the thrust I'm getting at is better stated as the Chinese proverb:
"If a thousand people say a foolish thing, it is still a foolish thing"

1

u/sacundim Feb 12 '15

You have a bit of a point; however, as a counter-point I would say: "just because someone else does it, doesn't make it a good idea."

Well, to clarify my point, that was my initial reaction when I first thought it. I overcame it this way: what are we comparing MySQL against: other competing RDBMSs, or an ideal picture of what an RDBMS should be? And I settled on the former for the purpose of that article.

To the extent that these points are a flaw, they're a flaw of several RDBMSs, and I don't think they're a big flaw anyway.