Caching proxy / smart read replica for Postgres. Try: curl -fsSL https://pgcache.com/try.sh | bash
7.3K
Cache your hottest reads and keep them fresh automatically. PgCache is a wire-compatible Postgres proxy. It serves cacheable reads from its own working set, keeps that set in step with your database through logical replication, and forwards everything else to the origin unchanged. One connection string, no code changes.
On a laptop or dev machine with Docker:
curl -fsSL https://pgcache.com/try.sh | bash
It finds your database (DATABASE_URL, a .env file, the PG* variables, or a running Postgres container), checks the origin is ready and tells you what to fix, starts this image as a container named pgcache-try, and prints the connection string to switch to.
curl -fsSL https://pgcache.com/try.sh | bash -s -- status # live hit rate
curl -fsSL https://pgcache.com/try.sh | bash -s -- stop # remove the container
The script is plain bash. Read it first if you like.
docker run -d -p 5432:5432 -p 9090:9090 pgcache/pgcache \
--upstream postgres://user:password@your-db-host:5432/myapp
/healthz. It's unauthenticated, so keep it off the public internet.The image bundles its own cache database, so there's nothing else to run.
services:
pgcache:
image: pgcache/pgcache:0.7.0
restart: always
ports: ["5432:5432", "9090:9090"]
environment:
UPSTREAM_URL: postgres://user@db:5432/myapp
ORIGIN_PASSWORD: ${ORIGIN_PASSWORD}
docker run --rm pgcache/pgcache check \
--upstream postgres://user:password@your-db-host:5432/myapp
It reports each requirement with a fix worded for your host (self-managed, RDS and Aurora, Cloud SQL, or Neon) and leaves nothing behind.
wal_level = logical)REPLICATION that owns the tables to cache, or a superuserFind out before you install anything. The Fit Analyzer takes a pg_stat_statements export and shows which of your queries PgCache would serve from cache. It runs in your browser, and nothing is uploaded.
latest, 0.7.0: multi-arch (amd64 and arm64)<version>-amd64, <version>-arm64: single architectureIn production, use a version tag like 0.7.0 rather than latest, so a restart never upgrades you by surprise.
Ask in Discord or email [email protected].
Content type
Image
Digest
sha256:34bee8e7b…
Size
121.7 MB
Last updated
10 days ago
docker pull pgcache/pgcache