JOINs the hard way: comparing MongoDB and Postgres
Dr. Michael Stonebraker and I have just published a new blog post on our series comparing MongoDB and Postgres. This second post compares JOINing data in MongoDB and Postgres, and follows on our previous post, “Schema Later” Considered Harmful.
This new post analyzes how to structure data in both systems to model a classical employee-department data model. We analyze why the embedded model won’t work for the Mongo case, and why the reference model is brittle in this system. The post also includes a simple performance benchmark, comparing both systems. Following on our best practices, it is open, public and anyone can reproduce it.
Our performance results were not surprising. On a given user group, last year, a user claimed:
If 500ms for a 1000x500 rows lookup is normal, thats very bad news for MongoDB in our project
and one of MongoDB’s top engineers replied:
That’s because you are choosing to do a join.
Update: discussion on Hacker News made it to the front page. Join the conversation.