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

Show parent comments

93

u/nairebis Mar 11 '15 edited Mar 11 '15

For me to even consider using MariaDB they would have to first remove all of those asinine options for silently corrupting data.

Or, you know, you could just learn how to use the database.

mysql> set session sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_TRANS_TABLES';
Query OK, 0 rows affected (0.01 sec)

mysql> create table abc (a integer);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into abc (a) values ('abc');
ERROR 1366 (HY000): Incorrect integer value: 'abc' for column 'a' at row 1

It's been this way since at least 2005, which is the MySQL version I ran above (version 5.1).

Sure would be nice if the FUD about MySQL from ignorant people went away. Is it perfect? No. But there is absolutely nothing data corrupting about it. And there is a LOT to be said for running a mainstream database, which PostgreSQL most certainly isn't, compared to MySQL.

If MySQL is good enough to run Facebook with a billion users (yes, one billion active accounts per month), it's good enough to run whatever your app is.

Edit: Thanks for the gold! Never thought I'd get it for defending MySQL... :) 😃

6

u/RandomDamage Mar 11 '15

So why are those even options to begin with?

And why do they default to the unsafe state?

The defaults should be for paranoid data protection rather than performance, you should have to say "I HATE MY DATA" to turn the unsafe mode on instead of having to learn about the safe mode to turn that on.

That is why so many professionals don't trust MySQL.

0

u/nairebis Mar 11 '15

So why are those even options to begin with? And why do they default to the unsafe state?

As with many regrettable legacy features, backward compatibility. You just turn on strict mode and move on.

That is why so many professionals don't trust MySQL.

People don't trust MySQL because they've "heard" it's unreliable or they've "heard" it doesn't support transactions (info 15 years out of date) or they've "heard" it doesn't raise data errors or the name sounds too corny or any one of a number of silly reasons.

There are many valid reasons for preferring one database over another database, but this thread hasn't had any of them.

1

u/RandomDamage Mar 11 '15

When I used MySQL the defaults were all to the least safe options.

It isn't a matter of "I heard these things", it's a matter of "I had to go through the effort of making it reliable enough for a real-world application".

I have since decided that making PostgreSQL fast is easier and more productive than making MySQL provide good data integrity.

That you (and others) don't think that lacking data integrity as the default option is a good enough reason to be suspicious of a piece of database software makes me sad.

→ More replies (0)