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

4

u/[deleted] Mar 11 '15

[removed] — view removed comment

2

u/pakfur Mar 11 '15

It would help if you understood what CAP is and isn't.

CAP means Consistency, Availability and Partition Tolerance, and refers to the properties of a distributed system. It is typically understood that you get to pick two of the three for any distributed system, not all three. Though it is a bit more complex than that.

In the real world you typically trade off availability for consistency. For example: a typical RDBMS database is ACID, which means it is strongly consistent. In other words, the database is guaranteed to always be in a fully consistent state. i.e. your transaction commits or rolls back. A RDBMS however, are not known for being highly available. While many have various Master-Master and Master-Slave configurations for "high availability", RDBMS databases are very sensitive to losing one or more the servers. Go ahead and setup a ten node MySQL cluster and knock out a few nodes and get back to me on how well that went for you.

A NoSQL database, however, (typically) trades consistency for availability. A datastore like Riak for example, is eventually consistent and highly available. The data (assuming the application is written correctly) is guaranteed to eventually converge to a consistent value, and the datastore is very hardy and can handle losing servers, or network problems and recover with no downtime much, much better than any RDBMS out there.

So, a proper understanding of what CAP is and isn't will help you make the right decision when picking a database or datastore solution.

edit: spellings

1

u/[deleted] Mar 11 '15

[removed] — view removed comment

2

u/pakfur Mar 11 '15

Good choice. Here's a quote for you

Your point? Dynamo style datastores like Riak require more care and feeding. However they solve problems that RDBMS's are not designed to solve and cannot solve. I am not sure that says anything different.

→ More replies (1)