Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What NoSQL database to use as replacement for MySQL?

When it comes to NoSQL, there are bewildering number of choices to select a specific NoSQL database as is clear in the NoSQL wiki.

In my application I want to replace mysql with NOSQL alternative. In my application I have user table which has one to many relation with large number of other tables. Some of these tables are in turn related to yet other tables. Also I have a user connected to another user if they are friends.

I do not have documents to store, so this eliminates document oriented NoSQL databases. I want very high performance. The NOSQL database should work very well with Play Framework and scala language. It should be open source and free.

So given above, what NoSQL database I should use?

like image 910
ace Avatar asked Jun 10 '11 20:06

ace


People also ask

Will MongoDB replace MySQL?

It's unlikely MongoDB will completely replace MySQL, but it's possible that both structured and unstructured databases will be used for different purposes in one environment. Developers interested in enterprise programming should learn both platforms to stay competitive in the job market.

Is NoSQL better than MySQL?

Furthermore, NoSQL is much more flexible than MySQL. One of the good things about MySQL database management is that it is available with a broad range of reporting tools that can help the validity of an application. On the other hand, NoSQL databases do not have reporting tools for performance testing and analysis.

Which NoSQL database should I use?

NoSQL databases vary in architecture and function, so you need to pick the type that is best for the desired task: In general, key-value stores are best for the persistent sharing of data by multiple processes or microservices in an application.


1 Answers

I think you may be misunderstanding the nature of "document databases". As such, I would recommend MongoDB, which is a document database, but I think you'll like it.

MongoDB stores "documents" which are basically JSON records. The cool part is it understands the internals of the documents it stores. So given a document like this:

{
  "name": "Gregg",
  "fave-lang": "Scala",
  "fave-colors": ["red", "blue"]
}

You can query on "fave-lang" or "fave-colors". You can even index on either of those fields, even the array "fave-colors", which would necessitate a many-to-many in relational land.

Play offers a MongoDB plugin which I have not used. You can also use the Casbah driver for MongoDB, which I have used a great deal and is excellent. The Rogue query DSL for MongoDB, written by FourSquare is also worth looking at if you like MongoDB.

MongoDB is extremely fast. In addition you will save yourself the hassle of writing schemas because any record can have any fields you want, and they are still searchable and indexable. Your data model will probably look much like it does now, with a users "collection" (like a table) and other collections with records referencing a user ID as needed. But if you need to add a field to one of your collections, you can do so at any time without worrying about the older records or data migration. There is technically no schema to MongoDB records, but you do end up organizing similar records into collections.

MongoDB is one of the most fun technologies I have happened to come across in the past few years. In that one happy Saturday I decided to check it out and within 15 minutes was productive and felt like I "got it". I routinely give a demo at work where I show people how to get started with MongoDB and Scala in 15 minutes and that includes installing MongoDB. Shameless plug if you're into web services, here's my blog post on getting started with MongoDB and Scalatra using Casbah: http://janxspirit.blogspot.com/2011/01/quick-webb-app-with-scala-mongodb.html

You should at the very least go to http://try.mongodb.org

That's what got me started.

Good luck!

like image 147
Janx Avatar answered Nov 05 '22 15:11

Janx