Redis is a key-value nosql database (non-relational database). Value types that support storage include string (string), list (linked list), set (set), zset (sorted set - ordered set) and hash (hash type). These data types support push/pop, add/remove, intersection, union, difference, and richer operations, and these operations are all atomic. To ensure efficiency, data is cached in memory.
NoSQL non-relational databases mainly refer to those non-relational, distributed data storage systems that generally do not guarantee ACID, mainly representing MongoDB. Redis, CouchDB. (Recommended learning: Redis video tutorial)
NoSQL proposes another concept, which is stored by key value, and the structure is unstable. Each tuple can have different values. The same fields will not be limited to a fixed structure, which can reduce some time and space overhead. Using this method, in order to obtain different information about the user, there is no need to perform multi-table queries like in a relational database. You only need to retrieve the corresponding value based on the key.
Key-value database for high-performance concurrent reading and writing
The main feature is extremely high concurrent reading and writing performance, such as Redis.
NoSql is suitable for storing unstructured data, such as articles and comments:
(1) These data are usually used for fuzzy processing, such as full-text search and machine learning, and are suitable for storage Simple data.
(2) These data are massive, and the growth rate is unpredictable.
(3) Obtaining data by key is very efficient, but the support for joins or other structured queries is relatively poor.
NoSql expands horizontally, and non-relational databases are naturally distributed, so load balancing can be achieved through clusters.
Non-relational is a flat data collection. Data can often be repeated. A single database is rarely separated, but is stored as a whole. This kind of whole block reading data is more efficient.
SQL databases are still powerful and can process transactions reliably and maintain transaction integrity. Only consider NoSql databases when your data is very large and operation expansion requires a more distributed system.
For more Redis-related technical articles, please visit the Introduction to Using Redis Database Tutorial column to learn!
The above is the detailed content of Is redis a relational database?. For more information, please follow other related articles on the PHP Chinese website!