Over a million developers have joined DZone.

MongoDB vs. PostgreSQL for NBA Data Crunching

· Java Zone

What every Java engineer should know about microservices: Reactive Microservices Architecture.  Brought to you in partnership with Lightbend.

There is a long-ish tradition of comparing things to MongoDB. You know, MongoDB vs. Oracle, and MongoDB vs. Cassandra, and MongoDB vs. Redis and CouchDB. Now, Dmitri Fontaine at tapoueh.org has provided a new comparison: MongoDB vs. PostgreSQL. Fontaine's comparison works with an interesting dataset comprised of 30 years worth of NBA scores, teams, wins, and so on - it's actually a response to an earlier article that used MongoDB's aggregation framework to work with the dataset - and shows how PostgreSQL would handle similar operations. 

Fontaine tries to follow the same queries as the earlier author, and finds that he sometimes produces produces slightly different results. Central to Fontaine's argument, though, is that his comparable SQL queries are more readable and more complete; in other words, he argues that it is clearer how he produced his results than it is in the MongoDB results.

Ultimately, Fontaine's argument is that MongoDB is late to the game. He says:

It's quite hard for me to appreciate the work done in the MongoDB aggregation framework really, when we've been enjoying advanced aggregation and statistics in PostgreSQL for a very long time. With the addition of Window Functions and Aggregate Functions for Statistics it's possible to implement advanced analysis right into your SQL queries.

Check out Fontaine's full article for the complete queries and his back-and-forth with the original NBA MongoDB article.

Microservices for Java, explained. Revitalize your legacy systems (and your career) with Reactive Microservices Architecture, a free O'Reilly book. Brought to you in partnership with Lightbend.


The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}