


How does a non-relational database help our web project and where can it be used?
I have a question now: What is the use of non-relational databases such as redis or memercach in our web programs? Where can it be used?
Reply content:
I have a question now: What is the use of non-relational databases such as redis or memercach in our web programs? Where can it be used?
https://www.zhihu.com/question/20059632
https://www.zhihu.com/question/20304711
It can be used when caching. If users use the cache when browsing our website, they no longer need to query the database. The data directly from the cache can reduce the pressure on the server database and keep the software and hardware running healthily. There are many places where it is used, I just give an example^_^
First of all, I have never heard of memercach, only memcache
1. Since non-relational databases are key-value, queries will be very fast. Relational databases support transactions and can support multi-table associations.
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. Generally speaking, they are mostly used for caching. Of course, there are many other application scenarios, such as redis can be used as a queue.
This is my personal understanding. We can distinguish databases from two perspectives: one is the storage medium (hard disk, memory); the other is the storage model, that is, the way to express and operate the data you save, similar to the file system to the hard disk.
Back to the main question, first of all, from the perspective of storage model, relational database is based on sets and relational algebra. Each table is a set. For table addition, deletion, modification and query, corresponding selection, union, It should be said that relational algebra operations such as intersection and connection are relatively comprehensive and rigorous, whether it is derivation at the mathematical level or testing of corporate informatization practices over the years. But at the same time, it also has limitations. For example, when you want to store an employee information, this employee information may have many attributes, such as position, rank, departments at all levels, transfer records, etc.; if you use a relational database, it will Multiple attribute tables and relationship tables will be created, and you can also use mongodb to store it, simply put it in a JSON data (PS: if it is just a query). Therefore, from this perspective, NOSQL represents a special storage model that can usually store certain types of data more simply. To give an example in life, you can imagine a relational database as a standard storage box, and NOSQL as a special container, such as a fishing rod bucket.
Secondly, from the storage media, memory-based databases like memcached/redis are usually used as caches to store commonly used data or sessions;
Finally, due to this optimization of NOSQL, it often appears in big data situations. This is also easy to understand. If the amount of data is small, the original relational database is enough. Therefore, many NOSQL are designed with clusters in mind, such as mongodb. You can easily configure a replica set (supporting read-write separation) and configure sharding.
The above are all conceptual things. If the subject needs to know more, I think there are two ways:
1. Search the Internet for sharing of excellent practices of XX database and see in what scenarios the industry uses NoSQL, for example:
http://sanwen8.cn/p/1a7xFmh.html
2 , look at the introduction of NOSQL cloud service, which usually comes with typical application scenarios of this database, such as:
https://www.aliyun.com/product/kvstore?spm=5176.7960203.237031.34.78OO9N
When frequent updates are required and the data patterns are different, a Philippine relational database is used.
For example, there is a function to send Weibo. Some Weibo may have pictures, and some may be plain text. How about using mysql to save here? Use text to store the formatted json, or two fields.
The first method is not conducive to searching, and the second method will cause a waste of storage space

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
