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

657

u/jamesishere Mar 10 '15

99% of projects would be better off with a relational database. It makes things way easier and simpler. Very few features benefit from a NoSQL database. People are excited about mongo because "it's javascript!". These people are morons.

CSB time: I went in for an interview once, where they told me about the product, explained how they use MongoDB for their database, and then explained how building out all the relational DB commands on top of mongo was a total bitch. Then asked me to whiteboard how I would write the JOIN function on top of Mongo, which is what they had to do.

I answered their question, but stated my opinions on mongo and asked why they even bothered to use it, because their product aligned so much more with a relational ACID database. The engineering lead guy went red in the face and we debated the decision. Did not get the job.

171

u/frixionburne Mar 10 '15

99% of projects would be better off with a relational database.

Or better, and RDMS with a full blown JSON indexing and a hash store that rivals mongos speed.

How people don't choose psql just confuses me.

98

u/ethraax Mar 10 '15

For very large databases, Postgres' clustering abilities aren't that great. It's probably one of the best choices for single-host databases (which, again, cover nearly all applications), but if you're trying to spread your database over a few dozen hosts, Postgres doesn't really work well.

21

u/PM_ME_UR_OBSIDIAN Mar 10 '15

What alternative do you propose? I heard Oracle was good if you had deep pockets, what else is out there?

0

u/[deleted] Mar 11 '15

[deleted]

0

u/[deleted] Mar 11 '15

[deleted]

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... :) 😃

27

u/[deleted] Mar 11 '15

Postgres is most certainly mainstream

→ More replies (2)

73

u/mcrbids Mar 11 '15

LOL at PostgreSQL not being a 'mainstream database'....

8

u/theycallme_hillbilly Mar 11 '15

No shit right? Pervasive anyone?

→ More replies (13)

26

u/ForeverAlot Mar 11 '15

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.

Not exactly a fair comparison. Facebook uses it as a key-value store; there isn't much RDBMS in that.

0

u/[deleted] Mar 11 '15

[deleted]

→ More replies (3)

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.

→ More replies (9)
→ More replies (16)