What is the help of non-relational databases for our web projects? where can we use them?

Source: Internet
Author: User
I have a question about the usage of redis or memercach non-relational databases in our web programs. I have a question about the usage of redis or memercach in what is the use of our web programs?

Reply content:

I have a question about the usage of non-relational databases such as redis or memercach in our web programs.

Https://www.zhihu.com/question/20059632

Https://www.zhihu.com/question/20304711

Cache can be used. When a user browses our website, if the cache is used, the user does not need to query the database any more. The data in the cache can reduce the pressure on the server database and make the software and hardware run properly. There are still many things to use. I just want to give an example. ^_^

First, memercach has never heard of memcache.
1. since non-relational databases are key-value, queries are very fast. relational databases support transactions and support multi-table Association.
2. Redis and Memcache are both key-value storage systems. They are all memory-based databases. of course, some databases can be flushed to the hard disk, which is generally used for caching. Of course, there are many other application scenarios, such as redis, which can be used for queues.

This is my understanding. We can distinguish databases from two perspectives: storage medium (hard disk, memory) and storage model, that is, how to express and operate your stored data, A file system is similar to a hard disk.

Back to the subject question, first of all, from the storage model, relational databases are based on sets and relational algebra, and each table is a set, for relational algebra operations such as table addition, deletion, modification, query and selection, addition, intersection, and join, it should be said that it is comprehensive and rigorous, whether it is mathematical derivation, it is also a test of enterprise informatization practices over the years. But at the same time, it also has limitations. for example, if you want to store an employee information, this employee information may have many attributes, such as positions, ranks, departments at all levels, and transfer records; when you use a relational database, you will create multiple attribute tables and relational tables. at the same time, you can use mongodb for storage and simply put it in a JSON data (PS: if it is only a query ). Therefore, from this perspective, NOSQL represents a special storage model that can simplify the storage of certain types of data. For example, you can think of a relational database as a standard storage box, while NOSQL can think of it as a special container, such as a fishing rod bucket.

Second, in terms of storage media, memcached/redis databases are memory-based databases, which are usually used as caches to store common data or sessions;

Finally, this kind of NOSQL optimization often occurs in the case of big data. This is also easy to understand. if the data volume is small, it would have been enough for relational databases. Therefore, many NOSQL clusters have been designed at the beginning. for example, mongodb, you can easily configure replica sets (supporting read/write splitting) and configure shards.

The above are all conceptual things. if the subject needs further understanding, I think there are two ways:

1. search for the excellent practices of XX databases on the internet to see the specific use cases of NoSQL in the industry. for example:
Http://sanwen8.cn/p/1a7xFmh.html
2. see the introduction of NOSQL Cloud services. The typical application scenarios of this database are usually included, for example:
Https://www.aliyun.com/product/kvstore? Spm = 5176.7960203.237031.34.78OO9N

Frequent updates are required, and relational databases are used when data models are different,
For example, some Weibo posts may have images and some may be plain text. here, if you use mysql to store formatted json or two fields.
The first method is not conducive to search, and the second method causes a waste of storage space.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.