Which NoSQL database to use as a replacement for MySQL?

When it comes to NoSQL, there is perplexity for choosing a specific NoSQL database, as seen in the NoSQL wiki.

In my application, I want to replace mysql with an NOSQL alternative. In my application, I have a user table that has a one-to-one relationship with a lot of other tables. Some of these tables, in turn, are associated with other tables. I also have a user connected to another user if they are friends.

I have no documents to store, so this excludes document-oriented NoSQL databases. I want a very high performance. The NOSQL database should work well with the Play Framework and the scala language. It should be open and free.

As stated above, which NoSQL database should I use?

+6
source share
4 answers

At the moment, the answer is no, I'm afraid.

You can't just transform your relational model with joins into a keystore design and expect this to be a 1: 1 mapping. From what you said, it seems that you have connections, some of them are recursive, i.e. Refers to another row from the same table.

You can start by denormalizing an existing relational schema to bring it closer to the design you want to achieve. Then you could see more easily if what you are trying to do can be done in practice, and which technology to choose. You can even continue to use MySQL. Just because you can have joins doesn’t mean what you need, which allows you to have a non-relational design in a relational DBMS such as MySQL.

Also, keep in mind that non-relational databases were designed for scalability - not performance! Unless you have thousands of users and a server farm, a traditional relational database might work best for you.

+1
source

I think you may not understand the nature of "document databases." So I would recommend MongoDB, which is a document database, but I think you will like it.

MongoDB stores "documents", which are mostly JSON entries. The nice part is understanding the internal documents that it stores. So give this document:

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

You can request "fave-lang" or "fave-colors". You can even index in any of these fields, even the fave-colors array, which would require many-to-many in relational lands.

Play offers a MongoDB plugin that I have not used. You can also use the Casbah driver for MongoDB , which I used a lot and fine. Rogue's DSL query for MongoDB, written by FourSquare, is also worth a look if you like MongoDB.

MongoDB is very fast. In addition, you save yourself the trouble of writing schemas, because any record can have any fields you want, and they are still searchable and indexable. Your data model is likely to look the same as it is now, with a custom “collection” (like a table) and other collections with entries that reference the user ID as needed. But if you need to add a field to one of your collections, you can do this anytime without worrying about old records or data migration. Technically there is no schema for MongoDB entries, but you end up organizing similar entries in collections.

MongoDB is one of the funniest technologies I've come across in the last few years. This happy Saturday, I decided to check it out and for 15 minutes was productive and felt that I had “received”. I regularly give demos at work, where I show people how to get started with MongoDB and Scala in 15 minutes, and this includes installing MongoDB. Shameless plug if you are in web services, here is my blog post about getting started with MongoDB and Scalatra using Casbah: http://janxspirit.blogspot.com/2011/01/quick-webb-app-with-scala -mongodb.html

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

What made me start.

Good luck

+8
source

Hmm, you need a very high crawl efficiency, and you use the word friends. The first thing that comes to mind is the Graph databases. They are specifically designed for this particular case.

Try Neo4j http://neo4j.org/

It is free, open source, but also has commercial support and commercial licensing, it has excellent documentation and can be accessed from many languages ​​(REST interface).

It is written in java, so you have native libraries, or you can paste it into your java / scala application.

+2
source

As for MongoDB or Cassendra, you now (December 2016, for 5 years) try longevityframework.org .

Build your domain model using standard Scala idioms such as case classes, companion objects, options, and immutable collections. Tell us about the types in your model and we will ensure conservation.

See “ Awesomeness Durability Details with Macro Annotations! ” From John Sullivan .
It provides an example on GitHub .

If you have looked at longevity for a long time, you will be amazed at how easy it has become to start your domain objects. And the best part is that all attachment is preserved in annotations. Your domain classes are completely free of persistence issues, expressing your domain model perfectly and ready for use in all parts of your application.

0
source

Source: https://habr.com/ru/post/890254/


All Articles