Dragonfly Cloud is now available on the AWS Marketplace - Learn More

Question: Is Redis a Relational Database?

Answer

No, Redis is not a relational database. Redis, short for Remote Dictionary Server, is an open-source, in-memory data structure store that can be used as a database, cache, or message broker. It supports various types of data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, and geospatial indexes with radius queries.

Relational databases, on the other hand, are based on the relational model, where data is organized into tables with rows and columns. They typically use SQL (Structured Query Language) to manage and query the data.

Although Redis is not a relational database, it can still be used alongside one to improve performance by caching frequently accessed data or offloading complex operations.

Here's an example of how you can store and retrieve a simple key-value pair in Redis using the SET and GET commands:

SET name "John Doe" GET name

In this example, we stored the value "John Doe" with the key "name". To retrieve the value, we used the GET command followed by the key.

When compared to a relational database, a similar operation would involve creating a table with columns, inserting data using SQL, and then querying the data using a SELECT statement:

CREATE TABLE users ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL ); INSERT INTO users (name) VALUES ('John Doe'); SELECT name FROM users WHERE id = 1;

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Switch & save up to 80% 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost