# Redis

> Redis commands through the pgredis gateway, with data in PostgreSQL tables.

---

LLMS index: [llms.txt](/llms.txt)

---

Redis clients send Redis 7.2.4 standalone commands to the **pgredis** gateway. The gateway runs each command in
the `pg_redis` extension, which keeps every key in ordinary PostgreSQL tables. The same commands are callable from
SQL, so a Redis write can commit or roll back together with business rows.

| Item | Detail |
| --- | --- |
| Status | **Release candidate.** pgredis 0.1.0; candidate `v0.1.0-rc1` (2026-11-08): local tag on `2f8ee8d6a`, packages from `11411411d`. Not published. Extension schema 0.54, ABI 3. |
| Port | 6379 in the Mimus plan; the gateway defaults to `127.0.0.1:56379` |
| Gateway | `pgredis`, Go: RESP2/RESP3, TLS, authentication, sessions, `MULTI` queues, pools |
| Extension | `pg_redis`, C, schema `redis`; needs superuser and `shared_preload_libraries` (background expiry worker) |
| Kernel patch | none; runs on stock PostgreSQL 18 |
| Licence | Apache-2.0; code derived from Redis 7.2.4 keeps its BSD-3-Clause notices |
{.fields}

## How Redis maps onto PostgreSQL {#mapping}

- **Data types** are WAL-logged tables: `redis._keyspace` holds the binary key, type, value and expiry;
  `_hash`, `_list`, `_set`, `_zset` and the `_stream*` tables hold the rest.
- **Each command is one PostgreSQL transaction.** The reply leaves only after commit. `EXEC` runs the whole queue
  in one transaction. A reply whose outcome is unknown is never replayed.
- **SQL**: `redis.command(text[], db)` and `redis.command_bin(bytea[], db)` call the same core and join the caller's transaction
  (`READ COMMITTED` only).
- **Pub/Sub and blocking commands** use tables plus `NOTIFY` wake-ups and leases.
- **Write commands** other than plain `GET`/`SET` run one at a time per database; WAL flush latency limits their
  throughput.

## Try it {#try}

```sql
CREATE TEMP TABLE demo_row(id integer PRIMARY KEY, state text);
BEGIN;
INSERT INTO demo_row VALUES (42, 'ready');
SELECT redis.command(ARRAY['SET', 'demo:42', 'ready']);
ROLLBACK;  -- the row and the Redis key both disappear
SELECT convert_from(redis.command(ARRAY['EXISTS', 'demo:42']), 'UTF8');  -- :0
```

## Out of scope {#out-of-scope}

Lua scripting, Functions, Cluster, Sentinel, Redis replication, AOF/RDB files, `maxmemory` eviction and modules.
Redis ACL mode is Beta and incomplete. The extension needs superuser and preload, so it does not install on
managed PostgreSQL services.

## Source and credit {#source}

pgredis is developed by PGSTY and pgredis contributors. Redis is a trademark of Redis Ltd.; Mimus is not affiliated
with Redis Ltd.

Pages in this section adapt the pgredis companion documentation, © PGSTY and pgredis contributors, CC BY 4.0;
see [Licence and attribution](/license/#adapted).

---

Section pages:

- [Quick start](/docs/redis/quickstart/): Install pgredis 0.1.0, configure PostgreSQL, start the gateway and run PING, SET and GET.
- [Tutorials](/docs/redis/tutorial/): Connect clients, roll back Redis writes with SQL, store binary data and build a transactional outbox.
- [Compatibility](/docs/redis/compatibility/): Committed and Beta features, unsupported Redis features, differences and test results.
- [Architecture](/docs/redis/architecture/): Gateway, extension and storage: how one semantic core serves RESP and SQL.
- [Reference](/docs/redis/reference/): Commands, data types, SQL API, transactions, Pub/Sub, Streams, configuration and limits.
- [Operations](/docs/redis/operations/): Install, build, secure, upgrade, back up and recover pgredis.
- [Status](/docs/redis/status/): Current candidate, what has been verified on it, known issues and the remaining roadmap.
- [Releases](/docs/redis/releases/): The release candidate and the development checkpoints that led to it.
- [Design](/docs/redis/design/): Design decisions behind pgredis.

---

Backlinks:

- [Kafka](/docs/kafka/)
- [Protocol & Capability Matrix](/docs/reference/matrix/)
