Skip to the workspace
Pebellslearn by building
What is Redis?  ›  Lesson

Redis vs SQL and NoSQL Databases

Redis vs SQL/NoSQL DBs 12 minChoose Redis when you know exactly which key you will ask for and need the answer in well under a millisecond; choose a SQL or document database when you need ad-hoc queries, joins or a dataset larger than memory.

redis / Redis vs SQL and NoSQL Databases

Explore each scene at your own pace.

01 · The rule

The rule

Redis vs SQL and NoSQL Databases

A new Wordcraft developer suggests moving the whole game into Redis "because it is faster". Another wants to drop Redis "because PostgreSQL can do everything". Both are missing the point: the stores answer different kinds of question, and most real apps use both.

The rule

Redis answers questions you can name by key; databases answer questions you describe.

A SQL database (PostgreSQL, MySQL) lets you describe what you want: "players from Pune who joined in March, sorted by coins". It plans a search, uses indexes, joins tables, enforces relationships and keeps data safely on disk. Its dataset can be far larger than memory.

A document or wide-column NoSQL database (MongoDB, Cassandra) relaxes the fixed tables but still lets you query by fields inside the data and stores it mainly on disk.

Redis is a key-value store. You must know the key: player:asha, leaderboard, session:9f2c. Core Redis has no WHERE clause over values and no joins (add-on modules such as Redis Search add indexes, but they are beyond the fundamentals). In exchange, a lookup by key is served straight from memory, and the built-in structures (sorted sets, lists, sets) do work that would otherwise need a query.

Question Best fit
What is Asha's score right now? Redis
Who are the top ten players? Redis (sorted set)
Which Pune players spent over 500 coins in March? SQL
What did player 1042 buy last year? SQL

When to choose Redis: the data is small enough for RAM, you always reach it through a known key, you need answers in well under a millisecond, or the data has a lifetime (cache, session, rate limit). When not to: you need ad-hoc filtering, relationships between records, or a dataset much bigger than memory. Then Redis sits beside the main database, never instead of it.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.