pg_redis
pg_redis · Redis protocol service using PostgreSQL shared memory and logged tables
Overview
PostgreSQL · 15, 16, 17, 18
Usage
Sources:
- README.md
- Cargo.toml
- pg_redis.control
- src/lib.rs
- sql/schema.sql
- sql/views.sql
- docs/installation.md
- docs/configuration.md
- docs/STORAGE.md
- docs/operations.md
- docs/command-coverage.md
pg_redis exposes a Redis protocol listener backed by PostgreSQL shared memory and WAL-logged tables. The reviewed, unreleased source has Cargo version 0.0.0 and supports PostgreSQL 15–18. Its extension SQL is generated from pgrx declarations plus the bundled schema and view files; this source version is not a published stable release.
Enable the Listener
Install the matching library, preserve other preload entries and configure the database. Reserve worker slots in max_worker_processes; the default pool has four workers. Restart PostgreSQL before creating the extension as a superuser in the configured database.
The nonrelocatable extension creates the redis schema. Its default listener port is 6379. Redis logical databases 0–15 all belong to the one PostgreSQL database selected by redis.database.
Storage and SQL Access
The default policies place logical databases 0–7 in memory and 8–15 in logged tables. Memory data is lost on restart unless recovered through the documented snapshot mechanism; snapshots do not give one global instant across every memory database. Logged data participates in PostgreSQL WAL, replication and backups. The default appendfsync policy is always; relaxing it can lose recently acknowledged writes after a crash.
Inspect policies before using redis.set_policy to migrate a database between storage modes. SQL views such as redis.strings, redis.hashes and redis.lists expose data and expiry information; the raw table representation is an implementation detail. redis.add_workers and redis.remove_workers adjust the pool within configured capacity. Consult the command coverage table before depending on Redis compatibility.
Authentication and Upgrades
The Redis listener does not use PostgreSQL client authentication or pg_hba.conf: commands run with worker privileges. Keep the loopback binding unless Redis password/ACL and network access have been deliberately configured. With no password configured, the default user permits passwordless access. The ACL file is outside pg_dump and must be protected and backed up separately.
There are no versioned extension upgrade scripts in this revision. Existing data needs reviewed in-place schema migration when the source schema changes. A server restoring a dump containing the extension must already preload the library. Do not treat illustrative future release images or installer versions as verified publications.