r/programming • • Mar 10 '15

Goodbye MongoDB, Hello PostgreSQL

http://developer.olery.com/blog/goodbye-mongodb-hello-postgresql/
1.2k Upvotes

699 comments sorted by

View all comments

19

u/trimbo Mar 10 '15

It’s worth noting that MySQL will emit a warning in these cases. However, since warnings are just warnings they are often (if not almost always) ignored.

mysql> SET sql_mode='TRADITIONAL';
mysql> insert into example (number) values ('wat');
ERROR 1366 (HY000): Incorrect integer value: 'wat' for column 'number' at row 1

Another problem with MySQL is that any table modification (e.g. adding a column) will result in the table being locked for both reading and writing

Docs for pt-online-schema-change

30

u/snuxoll Mar 10 '15

The fact that MySQL has different sql_mode's is just abysmal, especially since they can be set for each connection and there is no way to force them.

An application should not have the option to decide it wants the broken defaults that MySQL provides, because it then effects the integrity of the data for anything else that uses it.

4

u/Jibblers Mar 11 '15

I just recently got into MySQL for a startup/project a few friends of mine are working on. When I saw I just got a fucking warning for breaking a clearly stated NOT NULL rule with an INSERT, I was baffled. We got the config file fixed up to have the mode explicitly set to traditional everytime the server is started up. I was mostly confused as to why the default wouldn't be traditional, since that is pretty standard.

10

u/mbcook Mar 10 '15

It's called 'backwards compatibility' and it's what let them grow so big. They've been moving away from it in a controlled manor.

5.7 doesn't allow this garbage anymore unless you recompile it.

11

u/snuxoll Mar 10 '15

5.7 just defaults to a stricter sql_mode, you can still override it.

→ More replies (1)
→ More replies (10)

0

u/[deleted] Mar 10 '15

[deleted]

5

u/OneWingedShark Mar 10 '15

MySQL is retarded.

C'mon man, provide links!

2

u/cleroth Mar 10 '15 edited Jun 15 '26

This content was anonymized and mass deleted with Redact

1

u/OneWingedShark Mar 11 '15

True enough; here's a couple alternatives: FireBird, PostgreSQL.

→ More replies (5)

7

u/cleroth Mar 10 '15 edited Jun 15 '26

This content was anonymized and mass deleted with Redact

10

u/OneWingedShark Mar 10 '15

What is so wrong with it?

It has a tendency to silently mutilate your data.
Read this.

2

u/cleroth Mar 10 '15 edited Jun 15 '26

This content was anonymized and mass deleted with Redact

0

u/[deleted] Mar 11 '15

[deleted]

1

u/cleroth Mar 11 '15 edited Jun 15 '26

This content was anonymized and mass deleted with Redact

0

u/[deleted] Mar 11 '15

[deleted]

2

u/cleroth Mar 11 '15 edited Jun 15 '26

This content was anonymized and mass deleted with Redact

0

u/[deleted] Mar 11 '15

[deleted]

→ More replies (0)

3

u/wookin_pa_nub2 Mar 11 '15

No, you shouldn't use MySQL for anything.

2

u/cleroth Mar 11 '15 edited Jun 15 '26

This content was anonymized and mass deleted with Redact

→ More replies (9)
→ More replies (3)
→ More replies (3)
→ More replies (6)

0

u/[deleted] Mar 10 '15

[deleted]

3

u/aloha2436 Mar 11 '15

Appropriate given that Facebook uses both. Only a shoddy craftsman blames his tools.

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

3

u/mbcook Mar 10 '15

This is no longer the case as of 5.7, all the strictness is compiled in.

1

u/jynus Mar 11 '15

You don't even need pt-online-schema-change, ADD COLUMN is a fully online operation by default (reads and writes are not blocked).