Is Redis a NoSQL Database? What Kind It Is, and What It Isn't
Yes. Redis is a NoSQL database: an in-memory key-value store in which every value is a data structure, such as a string, hash, list, set, sorted set or stream, rather than an opaque blob. It has no tables, no fixed schema and no joins, and you work with data through commands, not SQL.
The label covers a lot of ground. NoSQL means everything that isn't relational, and its four main families behave very differently: key-value, document, wide-column and graph databases. Redis belongs to the first, and its built-in extras reach part of the way toward the second. That placement predicts most of what you meet when you build on it: how you query, how much a crash can cost you, what a transaction promises, and which keys you can use together in a cluster. This page goes through each and ends with Java code for the modeling style they lead to.
Redisson, the Java client for Valkey and Redis, is our product. We checked the facts on this page on November 23, 2026, against Redis Open Source 8.12.0, released on November 22, 2026, and Valkey 9.2.0, released on November 18, 2026. The Java samples compile against Redisson 4.8.0.
Redis and Valkey as NoSQL Databases at a Glance
Valkey, the BSD-licensed fork of Redis, belongs to the same family, so the table covers both.
| Redis Open Source 8.12 | Valkey 9.2 | |
|---|---|---|
| NoSQL family | Key-value store whose values are typed data structures | The same |
| License | RSALv2, SSPLv1 or AGPLv3, your choice (Redis 8.0 and later) | BSD 3-Clause |
| Keys and values | Binary-safe string keys; strings, hashes, lists, sets, sorted sets, streams, bitmaps, HyperLogLogs and geospatial indexes, plus vector sets (beta) and, since 8.8, arrays | The same core types, without vector sets or arrays, plus the Path Hash type added in 9.2 |
| JSON documents | Included since 8.0 | Valkey JSON module |
| Secondary indexes and search | Redis Search (full-text, numeric, tag, geo and vector), included since 8.0 | valkey-search module (numeric, tag, full-text and vector); version 1.3 needs Valkey 9.1 or later |
| Time series and probabilistic types | Included: time series, Bloom, cuckoo, count-min sketch, top-k, t-digest | Bloom filters through the Valkey Bloom module; no official time series module |
| Graph queries | None since RedisGraph reached end of life in January 2025 | None |
| SQL | None in the server | None |
| Persistence out of the box | RDB snapshots on a schedule; append-only file off | The same |
| Replication | Asynchronous; WAIT and WAITAOF narrow the gap | The same |
| Scaling out | Redis Cluster, 16,384 hash slots | Valkey Cluster, 16,384 hash slots |
What Kind of NoSQL Database Is Redis?
Redis is a key-value store. Every piece of data sits under a key, a binary-safe string of up to 512 MB, although in practice keys are short names such as user:42. Redis differs from the simplest key-value stores in its values. Memcached stores each value as a plain string; Redis gives each value one of a set of data types and operates on it in place: it appends to a list, increments a field in a hash, adds a member to a sorted set or trims a stream, atomically and without sending the value back to the client.
That is why Redis is often called a data structure store. Its README lists both roles: a data structure server, and a NoSQL data store for "Key-value, document, and time series data storage". Valkey's README calls Valkey a data structure server that "primarily serves key/value workloads".
Two things follow from the model. First, you reach data by naming its key. Without an index you build or declare, nothing will find "all users in Berlin" for you; the server can enumerate keys with SCAN, but that walks the whole keyspace, so it suits operators better than application code. Second, the data lives in memory, which is what makes Redis an in-memory database. Redis uses disk to survive restarts and serves every read from memory, so the dataset you can hold is the memory you are willing to pay for.
In one phrase, Redis is an in-memory NoSQL key-value database whose values are data structures. With the components Redis 8 folded into Redis Open Source, it can also act as a document store, a vector database and a time series store, and Redis now presents itself as more than a key-value store.
How Redis Compares With Other Kinds of NoSQL Database
The four NoSQL families differ on two questions: what a stored record looks like, and how you find it again.
| Family | Examples | Data model | How you query | Where Redis stands |
|---|---|---|---|---|
| Key-value | Redis, Valkey, Amazon DynamoDB, Aerospike | A value under a unique key | Get and put by key; some add secondary indexes | Redis is one, with typed values held in memory |
| Document | MongoDB, Couchbase | Self-describing JSON or BSON documents | A query language over any field, with indexes and aggregation | JSON values plus Redis Search come close for indexed queries; nothing for fields you didn't index, and no joins |
| Wide-column | Apache Cassandra, Apache HBase, Google Bigtable | Rows grouped by a partition key, each row with its own columns | CQL or a key-range API, designed around the partition key | Shares the model-around-your-reads discipline, but keeps data in RAM, so it holds far less per dollar |
| Graph | Neo4j, Amazon Neptune | Nodes and relationships | Traversal languages such as Cypher or Gremlin | Not a graph database any more |
Document stores are the family Redis has moved closest to. Redis 8 stores JSON documents natively, and Redis Search indexes their fields, so FT.SEARCH can answer "orders over 50 euros placed this week" without a hand-built index. Two differences remain: the index has to exist before the query does, whereas MongoDB will still run an unindexed query by scanning the collection, and Redis Search has no joins between indexes. Redis vs. MongoDB covers how teams use the two together, and Redis vs. Couchbase covers a document store with a cache built in.
Wide-column stores such as Apache Cassandra share Redis's habit of designing the data model around the queries, and both shard by key. They differ in where the data lives: Cassandra appends every write to a commit log and flushes it to SSTables on disk, so a cluster can hold far more data than its combined memory, with consistency tunable per query, while a Redis dataset has to fit in the cluster's RAM. When the two run together, Cassandra usually holds the system of record and Redis serves hot reads, counters and sessions.
Redis no longer offers graph queries. RedisGraph, the module that added Cypher queries to Redis, reached end of life on January 31, 2025, and Redis Stack stopped including it from version 7.2. Redis's own NoSQL overview still lists a graph database among the things Redis can be. FalkorDB, which forked RedisGraph in 2023, carries the project on as a separate graph database that loads into Redis as a module. In plain Redis or Valkey, relationships are sets or sorted sets of ids that you maintain yourself, which works for adjacency lists and follower counts but gives you no query language for multi-hop traversals.
Other key-value stores differ from Redis mainly in where they keep data. DynamoDB stores items on SSDs behind a managed API and adds document attributes and secondary indexes. Aerospike keeps its primary index in RAM and its records on flash. Both hold datasets that would be expensive in memory; Redis vs. DynamoDB and Redis vs. Aerospike cover when each fits.
Does Redis Support SQL?
No. There is no SQL parser in Redis and nothing to select from: you send commands such as GET, HSET, ZRANGE and XADD. The closest thing to a query language is Redis Search's own syntax for FT.SEARCH and FT.AGGREGATE, which filters, sorts and groups over indexed fields but isn't SQL.
Redis's own documentation says Redis "does not natively support SQL" and points to a workaround on the client: RedisVL's SQLQuery class, which wraps the sql-redis package and translates a subset of SELECT into FT.SEARCH and FT.AGGREGATE commands. sql-redis is a Python library, it can only read what a Redis Search index already covers, and it doesn't support joins. RedisVL's Java port (version 0.13.1) has no SQL class, so from Java you use the Redis Search query syntax directly, or the higher-level APIs in the Java section below.
Elsewhere the name has drifted, because several NoSQL databases now accept SQL-like languages: Cassandra has CQL, DynamoDB accepts PartiQL, and Couchbase has SQL++. NoSQL no longer reliably means "no SQL". For Redis and Valkey it still does.
What the NoSQL Label Means for Your Data
These consequences come straight from the in-memory key-value design, and each tends to catch out teams arriving from a relational database.
You Read by Key, Unless You Keep an Index
Every read starts from a key you can name. To find records by anything else, you either maintain the index yourself, as a set of ids per value or a sorted set scored by a number such as a timestamp or a price, or you declare a Redis Search or valkey-search index over hashes or JSON documents and let the server keep it current. Either way, you create the index before you need the query. A question nobody planned for, such as a one-off report, has no index to use, and the only fallback is iterating the keyspace, which is slow on a large dataset. That is a large part of why teams keep a relational or document database next to Redis.
The Dataset Lives in Memory
Redis serves every read and write from RAM, so the data, its indexes and the per-key overhead all have to fit in memory. By default there is no memory limit at all. Set maxmemory and the default noeviction policy makes writes fail once the limit is reached, while reads keep working. Choose an eviction policy such as allkeys-lru instead and Redis becomes a cache that deletes keys under pressure; the eviction policy guide covers the options. That makes "cache or database?" a question about configuration, as the Redis glossary entry explains. For Redis itself, spreading a database over RAM and flash is a commercial feature: Redis Flex, the successor to Redis on Flash, runs in Redis Software and Redis Cloud. Open-source Redis and Valkey keep everything in memory.
Durability Is a Setting, and the Default Is a Snapshot
A relational database commits durably by default. A fresh Redis or Valkey server only writes RDB snapshots on a schedule (after an hour if there was at least one change, after five minutes if there were 100, after a minute if there were 10,000) and leaves the append-only file off, so a crash loses everything written since the last snapshot. Turn on AOF with appendonly yes and its default fsync policy, everysec, narrows that to about one second of writes; appendfsync always fsyncs before acknowledging writes, at a large cost in throughput. Redis persistence covers RDB and AOF in detail.
Replication Is Asynchronous
A primary acknowledges a write before its replicas have it. If the primary fails and a replica is promoted, writes the replica never received are gone, although the clients that sent them saw them succeed (Redis replication explains the mechanics). WAIT blocks until a given number of replicas acknowledge, and WAITAOF until the write reaches the append-only file on the primary, the replicas or both, but the Redis documentation is explicit that "WAIT does not make Redis a strongly consistent store". Redis chooses low latency over strong consistency here, which puts a replicated deployment closer to the BASE end of ACID vs. BASE; the CAP theorem explains the trade-off underneath.
Transactions Are Atomic but Never Roll Back
MULTI and EXEC queue commands and run them as one isolated block: no other client's command runs in the middle. But if one command fails at run time, for example an increment on a key that holds a list, the others in the block still apply, because Redis has no rollback. WATCH adds optimistic locking by aborting EXEC when a watched key has changed, and Lua scripts and functions run atomically on the server. None of these gives you the all-or-nothing undo of a SQL transaction (Redis transactions covers each mechanism). In Java, Redisson's RTransaction keeps a list of changes and can roll them back on the client, at the price of locks on the keys it writes; How to Manage Transactions in Valkey and Redis on Java shows it.
In a Cluster, Keys Used Together Must Share a Slot
Redis Cluster and Valkey Cluster split the keyspace into 16,384 hash slots spread across primaries (Redis Cluster covers the topology). A command that touches several keys, a MULTI/EXEC block and a Lua script must all use keys from one slot, or the server replies with a CROSSSLOT error. Hash tags solve it: only the part of the key inside braces is hashed, so order:{c42}:1001 and orders-by-time:{c42} always land in the same slot. The cost is load: everything that shares a tag lives on one primary, so a tag that is too broad, such as one per country, turns into a hot shard.
Valkey Is a NoSQL Database Too
Valkey was forked from Redis 7.2.4 in March 2024 under the Linux Foundation, when Redis moved to source-available licenses, and it remains BSD-licensed. It speaks the same protocol and keeps the same core data types, persistence and cluster model, so every consequence in the previous section applies to it unchanged.
Redis 8 ships JSON, search, time series and probabilistic types in Redis Open Source itself; Valkey offers JSON, Bloom filters and search as separate modules, which valkey-bundle packages together with LDAP authentication. valkey-search 1.3 indexes hashes and JSON documents for numeric, tag, full-text and vector queries and requires Valkey 9.1 or later. The cores are drifting apart as well: Valkey 9.2 added a radix-tree Path Hash type that Redis lacks, and Redis 8.8 added an array type that Valkey lacks. Valkey vs. Redis covers the differences that matter when you choose, and Migrating from Redis to Valkey in Java covers the move.
Can Redis Be Your Primary Database?
Yes, when the data fits the model. Sessions, carts, feature flags, leaderboards and device state often live in Valkey or Redis as the system of record. Doing that safely means turning eviction off, choosing an fsync policy you can live with, replicating and backing up, sizing memory for growth, and designing every query before you write the first key; Using Valkey or Redis as a Primary Database in Java works through each step.
It is the wrong primary store for data you will query in ways you can't predict, data much larger than your memory budget, or changes that must commit or roll back across many records. Keep a relational or document database as the system of record there and run Redis next to it; Redis vs. Postgres and Redis vs. MongoDB cover those pairings.
Modeling NoSQL Data in Redis From Java
The modeling style that follows from all this starts from the reads. Decide which questions the application asks, store each record under a key, and keep one index per question. Redisson exposes each Redis type as a Java object, RMap for a hash and RScoredSortedSet for a sorted set among them (Redis Data Structures in Java maps them all), so the pattern reads like ordinary collection code.
The first sample stores an order as a hash and indexes it by time in a sorted set, so "the newest ten orders for this customer" is one range read. Both keys share the {c42} hash tag, which lets the two writes go out as one MULTI/EXEC block even on a cluster.
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.redisson.Redisson;
import org.redisson.api.BatchOptions;
import org.redisson.api.RBatch;
import org.redisson.api.RedissonClient;
import org.redisson.client.codec.StringCodec;
import org.redisson.config.Config;
public class OrdersByAccessPattern {
public static void main(String[] args) {
Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedissonClient redisson = Redisson.create(config);
// {c42} is a hash tag: in a cluster, every key that carries it hashes
// to the same slot, which is what allows one atomic write below.
String orderKey = "order:{c42}:1001";
String indexKey = "orders-by-time:{c42}";
long placedAt = System.currentTimeMillis();
// IN_MEMORY_ATOMIC sends both writes as one MULTI/EXEC block, so no
// reader sees the order without its index entry, or the reverse.
RBatch write = redisson.createBatch(BatchOptions.defaults()
.executionMode(BatchOptions.ExecutionMode.IN_MEMORY_ATOMIC));
write.<String, String>getMap(orderKey, StringCodec.INSTANCE)
.putAllAsync(Map.of("status", "PAID", "totalCents", "4999",
"placedAt", Long.toString(placedAt)));
write.<String>getScoredSortedSet(indexKey, StringCodec.INSTANCE)
.addAsync(placedAt, orderKey);
write.execute();
// The query this model was built for: the newest ten orders, read in
// one round trip. "All PAID orders" needs a second index of its own.
Collection<String> newest = redisson
.<String>getScoredSortedSet(indexKey, StringCodec.INSTANCE)
.valueRangeReversed(0, 9);
RBatch read = redisson.createBatch();
for (String key : newest) {
read.getMap(key, StringCodec.INSTANCE).readAllMapAsync();
}
List<?> orders = read.execute().getResponses();
System.out.println(orders);
redisson.shutdown();
}
}
Every additional question, such as orders by status or by amount, costs another index that your code must keep in step with the data. Redisson's Live Object Service maintains them for you. You annotate the fields you search on with @RIndex, and Redisson stores each object as a hash and keeps the indexes in Valkey or Redis, as a sorted set for numeric fields and a set of ids per value for the rest. Queries combine Conditions.eq, in, gt, ge, lt and le with and and or; the Live Object documentation lists the rest of the API.
// Order.java
import org.redisson.api.annotation.REntity;
import org.redisson.api.annotation.RId;
import org.redisson.api.annotation.RIndex;
@REntity
public class Order {
@RId
private String id;
@RIndex
private String customerId;
@RIndex
private String status;
@RIndex
private long totalCents;
// Redisson instantiates its proxy subclass through this constructor.
public Order() {
}
public Order(String id, String customerId, String status,
long totalCents) {
this.id = id;
this.customerId = customerId;
this.status = status;
this.totalCents = totalCents;
}
// Write accessors by hand: the docs rule out Lombok-generated ones.
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public long getTotalCents() {
return totalCents;
}
public void setTotalCents(long totalCents) {
this.totalCents = totalCents;
}
}
// OrdersWithIndexes.java
import java.util.Collection;
import org.redisson.Redisson;
import org.redisson.api.RLiveObjectService;
import org.redisson.api.RedissonClient;
import org.redisson.api.condition.Conditions;
import org.redisson.config.Config;
public class OrdersWithIndexes {
public static void main(String[] args) {
Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedissonClient redisson = Redisson.create(config);
RLiveObjectService orders = redisson.getLiveObjectService();
// persist() rejects ids that already exist (merge() overwrites), then
// writes each order as a hash and updates every @RIndex index.
orders.persist(new Order("1001", "c42", "PAID", 4999),
new Order("1002", "c42", "OPEN", 1250),
new Order("1003", "c77", "PAID", 18000));
// Answered from the indexes Redisson keeps, not by scanning keys.
Collection<Order> largePaid = orders.find(Order.class, Conditions.and(
Conditions.eq("status", "PAID"),
Conditions.ge("totalCents", 5000)));
for (Order order : largePaid) {
// Each getter on a live object reads that field from the server.
System.out.println(order.getId() + " " + order.getCustomerId());
}
redisson.shutdown();
}
}
Each index costs memory and an extra write per indexed field. In the open-source edition, every index key carries the class name as its hash tag, so in a cluster all of a class's indexes sit in one slot; the PRO edition partitions search indexes across the cluster and runs searches faster with less JVM memory.
For indexes the server maintains, RSearch wraps the FT.CREATE, FT.SEARCH and FT.AGGREGATE commands over hashes and JSON documents, and RJsonBucket stores JSON documents and edits them by path. How to Search Data Stored in Redis on Java and How To Store JSON with Redis on Java show both.
Redis as a NoSQL Database: Frequently Asked Questions
Is Redis a NoSQL Database?
Yes. Redis is a NoSQL key-value store: data lives under keys, each value is a typed data structure such as a hash, list, set, sorted set or stream, and you work with it through commands; there is no SQL. It keeps the dataset in memory and writes snapshots or an append-only log to disk for restarts. Redis 8 also includes JSON documents and Redis Search, which let it act as a document store for queries you index in advance.
What Type of Database Is Redis?
An in-memory key-value database, or more precisely a data structure store, because the server understands and operates on its values. In NoSQL terms it belongs to the key-value family, although Redis 8's JSON type and Redis Search take it part of the way toward a document database. It is used as a cache, as a primary database for fast-changing data, and as a message broker.
Is Redis a Document Database Like MongoDB?
Partly. Redis 8 stores JSON documents and can index their fields with Redis Search, so it can serve document lookups and indexed queries. Unlike MongoDB, it keeps documents in memory rather than on disk, answers only the queries an index declared in advance can serve, and has no joins or general query language. When teams run both, MongoDB usually stays the system of record and Redis handles caching, sessions and counters.
Is Redis ACID Compliant?
Not in the way a relational database is. Commands, MULTI/EXEC blocks and scripts run without interleaving, so other clients never see a partial state, but a command that fails inside a transaction does not roll the others back. Durability depends on configuration: with the append-only file set to fsync on every write, a single server keeps every write it acknowledged, but replication is asynchronous, so a failover can still lose writes. Constraints such as foreign keys don't exist.
Is Valkey a NoSQL Database?
Yes, of the same kind. Valkey is the BSD-licensed fork of Redis 7.2.4, maintained under the Linux Foundation since March 2024, and it shares Redis's key-value model, data types, persistence and clustering. Document storage and search come from separate modules, Valkey JSON and valkey-search, which valkey-bundle packages together.
Is Redis a Graph Database?
No. Redis has no graph type and no graph query language. RedisGraph, the module that added one, reached end of life on January 31, 2025, and Redis Stack stopped shipping it from version 7.2. FalkorDB, a fork of RedisGraph, continues as a separate graph database that loads into Redis as a module. In plain Redis or Valkey you can model relationships as sets or sorted sets of ids, which covers adjacency lists and counts but not multi-hop queries.
Similar articles
- Redis vs. MongoDB: When to Use Each, and Why Java Teams Run Both
- Using Valkey or Redis as a Primary Database in Java
- Redis vs. DynamoDB: When to Use Each, and How to Cache DynamoDB in Java
- Redis vs. Aerospike: When to Use Each for Low-Latency Java Workloads
- Redis vs. Postgres: When You Need Both, and When Postgres Is Enough
- Redis vs Memcached: Key Differences and When to Use Each
- Valkey vs Redis: A Complete 2026 Comparison
- Redis Data Structures in Java: A Practical Guide with Redisson
- How to Search Data Stored in Redis on Java