Postgres Extensions Quick Start
Install PostRESP into an existing PostgreSQL database and enable the in-process RESP gateway.
Install into an existing PostgreSQL database when you already run Postgres and only want the Redis-facing bits. Prefer the Docker Quick Start for evaluation and local demos.
Prerequisites
- PostgreSQL with ability to install extensions and edit
postgresql.conf/shared_preload_libraries - pg_cron for active TTL expiry (lazy expiry still works without it, but expired keys won’t be swept in the background)
- A release package for your Postgres major from GitHub Releases
redis-clito verify after install
1. Install pg_cron
sudo apt-get update
# Match the package to your Postgres major
sudo apt-get install -y postgresql-19-cronInstall pg_cron for your Postgres major
so CREATE EXTENSION pg_cron works, then continue below.
2. Install the PostRESP packages
Unpack the release artifacts (control / SQL / .so) into PostgreSQL’s extension
dirs:
PG_SHARE="$(pg_config --sharedir)"
PG_LIB="$(pg_config --pkglibdir)"
sudo cp -a extension/. "$PG_SHARE/extension/"
sudo cp -a lib/. "$PG_LIB/"
You need the product extensions plus two supporting ones Docker enables by default:
| Extension | Role |
|---|---|
pg_resp |
Storage API — schema pgresp |
pg_resp_gw_host |
In-process RESP background worker |
pg_cron |
Schedules active TTL deletion (install in step 1) |
pg_prewarm |
Reloads recently used table data into memory after restart |
3. Configure Postgres
Add to postgresql.conf (or use ALTER SYSTEM), then restart the server —
shared_preload_libraries changes are not reloadable:
shared_preload_libraries = 'pg_cron,pg_resp_gw_host,pg_prewarm'
# Autoprewarm is on by default when pg_prewarm is preloaded; set off to disable
pg_prewarm.autoprewarm = on
# pg_cron must target the database where you’ll create the extensions
cron.database_name = 'pg_resp'
# Gateway host
redis_gateway.database = 'pg_resp'
redis_gateway.setup_configuration_file = '/etc/pg_resp/SetupConfiguration.json'
Create a config file at that path:
{
"GatewayListenPort": 6379,
"UseLocalHost": false,
"PostgresHostName": "127.0.0.1",
"PostgresPort": 5432,
"PostgresDatabase": "pg_resp",
"PostgresSystemUser": "redis",
"PostgresPassword": "redis",
"RequirePostgres": true,
"StorageMode": "unlogged"
}
GatewayListenPort is the RESP port clients use (default 6379). Tune
storage with StorageMode — see Storage modes. Full env/JSON map:
Configuration.
Ensure the Postgres role and database named in the config exist and can connect locally (the gateway opens a backend connection using those credentials).
4. Create the extensions
-- Connect to the database named in cron.database_name
CREATE EXTENSION pg_cron;
CREATE EXTENSION pg_prewarm; -- buffer-cache warm / autoprewarm (recommended)
CREATE EXTENSION pg_resp;
CREATE EXTENSION pg_resp_gw_host;
pg_prewarm ships with a standard PostgreSQL install. Autoprewarm needs the
preload entry above plus a restart; details and how to disable:
Buffer cache prewarm.
After create, the background worker listens on GatewayListenPort.
5. Verify
redis-cli -p 6379 PING
# PONG
redis-cli -p 6379 SET hello world
redis-cli -p 6379 GET hello
# world
Continue with the redis-cli Quick Start for more commands and an SQL storage peek.
Troubleshooting
- Confirm
shared_preload_librariesincludespg_cron,pg_resp_gw_host, and (recommended)pg_prewarm, then restart Postgres (reload is not enough). - Check the Postgres log for background-worker startup errors if
:6379never accepts connections. - Confirm
redis_gateway.databaseandcron.database_namematch the database where you ranCREATE EXTENSION. - Confirm the gateway config file path is readable by the Postgres OS user.
- If the port is already bound, change
GatewayListenPort(or free the port) and restart.