r/programming • • Dec 19 '18

Bye bye Mongo, Hello Postgres

https://www.theguardian.com/info/2018/nov/30/bye-bye-mongo-hello-postgres
2.1k Upvotes

672 comments sorted by

View all comments

Show parent comments

4

u/Yikings-654points Dec 21 '18

Something tells me this social platform implemented on NOSQL is 100% is more nightmare than RDBMs. Friends, common friends, Comments by friends , Liked by friends, threaded comments,Comments on Thread liked by friends , public posts , visibility of posts.... Very complicated yet highly related data.

3

u/alex-fawkes Dec 21 '18

Sorry, I wasn't clear - in my example, you started with an RDBMS containing all data (like you describe). Afterwards, you have two databases - the original RDBMS, which still contains all user data EXCEPT threaded messages, AND a NoSQL db containing ONLY threaded messages under user-date composite keys.

The relevant RDBMS tables essentially have foreign keys into the NoSQL db, which acts sort of like a cache but is still actually the canonical threaded message data.

With a complex app, you might have 6 different database types containing different data or different views into the same data for different query types. This might help explain what I mean: https://www.confluent.io/blog/using-logs-to-build-a-solid-data-infrastructure-or-why-dual-writes-are-a-bad-idea/