Blog Post

MongoDB or MySQL? Why not both?

Stay on Top of Enterprise Technology Trends

Get updates impacting your industry from our GigaOm Research Community
Join the Community!
Thrillist CTO Mark O'Neill
Thrillist CTO Mark O’Neill

Someone please tell me we’ve gotten past the either-or debate over NoSQL and relational databases.

While NoSQL databases are foundational technologies for web startups — with most of these young companies opting for MongoDB, Cassandra, CouchDB or something else to fulfill their database needs — they might be better served going a hybrid route instead. There’s always room for a good, old-fashioned relational database — especially if they want to conduct and store financial transactions.

Just ask Mark O’Neill, CTO of Thrillist, a New York City-based media company that fields e-commerce and consumer recommendation services. Thrillist uses the NoSQL MongoDB to track and store tons of data about user interactions, but it’s MySQL (s orcl) all the way when it comes to bread-and-butter transactions and financial data that runs the company.

There’s a reason for that, O’Neill said. As great as MongoDB (or Cassandra or CouchDB or insert your favorite NoSQL entry here) may be, they’re still relatively immature compared to their SQL forebears. The ancillary tools aren’t as robust and it’s hard to find NoSQL talent.

“Skillsets around NoSQL are lacking and SQL [as a language] is relatively simple to learn — writing queries in SQL  is not so bad. With NoSQL, the tools are less robust and the barrier to entry is much higher,” O’Neill told me in an interview.

Thrillist, founded in 2005, looked at several NoSQL options but went with MongoDB over the NoSQL alternatives because at the time it was more stable, had a larger community around it and better tools than the others, O’Neill said.

Make no mistake: MongoDB is great for handling all the critical social interactions that take place. “For each action taken by a user, you want to know what the user’s friends were doing and you want to pull all that data out from a single location. Say you take an action on Meet Up, it will update your user references and update all your friends. Non-relational stores are really good at that and you can afford to keep that data in multiple places — we use Mongo for that,” O’Neill said.

But, for transactions? Well, “Mongo doesn’t really have transactions. If I write [data] in multiple places and want to check all that in at one time, Mongo can’t do that,” O’Neill said. When someone buys something at Thrillist’s Jackthreads site, the system must record their order and all the items associated with that order, or nothing works. “It all gets written or none of it does. Mongo is not good at that,” said O’Neill.

So a word to the wise web startup: NoSQL — in this case MongoDB — is great for what it does, but for your financial transactions stick with SQL.

For more discussion about the technologies — NoSQL or not — powering the web sites and mobile applications we all use, come check out GigaOM’s Structure conference next month.

Feature photo courtesy of Flickr user takomabibelot

8 Responses to “MongoDB or MySQL? Why not both?”

  1. Peter A

    The CTO of Amazon famously wrote in one of his blogs years ago that when it comes to large scale distributed computing, one can have Availability, Performance and Data Consistency, but only maximize two of these at a time.

    “NoSQL” tools throw Data Consistency out completely and maximizes Performance by eliminating relational constructs such as schemas and normalization. Great for some applications, horrible for others.

    For now, I stick to relational/SQL unless I’m absolutely convinced that there is no way to achieve my objectives with it. I am building a GIS iPhone app with an embedded SQLite back-end because it has built-in R-Tree indexing. A decade ago I wrote a text search engine with a BerkeleyDB back-end because all relational databases I tried sucked at maintaining an inverted index of millions of terms and running cosine co-efficient calculations of query/document vectors. If I had to re-write this today, I would probably take a good look at Mongo and Couch.

  2. tom dahlquist

    The only reason NoSQL databases exist is because of the Internet and the performance demands on major websites. NoSQL databases are not superior to or more advanced than relational databases–the opposite is actually true. They offer only one advantage–greater efficiency.

  3. Just another Not-DBA

    The barrier to entry is lower? Have you ever used SQL? Have you ever used Mongo? The latter is orders of magnitude easier to use if you’ve never seen either before.

  4. Steve Ardire

    Sure why not use NoSQL and SQL for instances like this but if you’re a media company with lots of unstructured data use a RDF graph database with a scalable metadata/data layer for dynamic authoring like outlined here Sports Are The Semantic Focus In Britain At The BBC And In Brazil At Globo