Overview
Stop copying everything.
Stop copying your entire database. PgCache drops in and caches only hot data for fast, real-time reads. Launch a free instance in minutes.
PgCache - Smart Read Replica for PostgreSQL
Stop Over-Provisioning
If you're using traditional read replicas to scale PostgreSQL, you may be paying to duplicate far more data than your workload actually needs. That means more always-on compute, more storage, more transfer cost, and more operational overhead. PgCache takes a simpler approach.
The Pareto Advantage
PgCache acts as a demand-driven proxy in front of PostgreSQL. It automatically caches the queries and data that are used most often, so you can get the benefits of a read replica without duplicating your full database footprint. The result is faster reads and lower infrastructure waste.
Drop-In Deployment
PgCache is a wire-compatible PostgreSQL proxy. Just update your connection string. No application code changes, no Redis layer, and no separate cache invalidation logic. Uncacheable queries pass through transparently to your origin database.
Always Fresh
PgCache uses PostgreSQL logical replication to keep cached data synchronized with the source database. Writes continue to go directly to your origin database, while reads are served from cache when possible. That means you can reduce stale-cache risk without adding complexity to your application.
Works With Your Existing Stack
PgCache works with PostgreSQL 16, 17, and 18, and supports any ORM or driver that speaks the PostgreSQL wire protocol. It handles parameterized queries, JOINs, aggregations, GROUP BY, DISTINCT, and window functions. If your app runs on Postgres, PgCache can fit into your existing stack.
Pricing That Scales With You
Start with a free small instance or 30-day free trial to test PgCache on a real workload before committing. After that, PgCache uses a flat monthly software fee per instance, making costs predictable and easy to budget.
For larger deployments or private enterprise offers, contact aws-team@pgcache.com
Highlights
- Cache the 20%, Offload the 80%: Automatically identifies and caches hot query data using demand-driven logic. Stop brute-force scaling and paying to replicate 100% of your cold data.
- Always Fresh, Never Stale: PostgreSQL Logical Replication (CDC) keeps cached data perfectly in sync in real time. No TTL guesses, no stale reads, no cache invalidation logic in your application.
- Test for Free on a Small Workload, then enjoy Simple Flat Monthly Pricing. No per-query charges, no surprise bills. Running at scale? Contact us for a private offer.
Details
Introducing multi-product solutions
You can now purchase comprehensive solutions tailored to use cases and industries.
Features and programs
Financing for AWS Marketplace purchases
Pricing
Free trial
Dimension | Cost/hour |
|---|---|
m6g.large Recommended | $0.137 |
m6g.medium | $0.0681 |
m6g.4xlarge | $0.959 |
m6g.xlarge | $0.274 |
m6g.2xlarge | $0.548 |
t4g.small | $0.00 |
Vendor refund policy
contact aws-team@pgcache.com
How can we make this page better?
Legal
Vendor terms and conditions
Content disclaimer
Delivery details
64-bit (Arm) Amazon Machine Image (AMI)
Amazon Machine Image (AMI)
An AMI is a virtual image that provides the information required to launch an instance. Amazon EC2 (Elastic Compute Cloud) instances are virtual servers on which you can run your applications and workloads, offering varying combinations of CPU, memory, storage, and networking resources. You can launch as many instances from as many different AMIs as you need.
Version release notes
0.4.9 - 2026-04-24
Materialized query results - for queries that reduce a large input to a small output (aggregates, window functions, GROUP BY, DISTINCT), pgcache now maintains a second tier of cache that stores the result rather than recomputing it from source rows.
Pre-PG18 search_path change tracking - PostgreSQL 16 and 17 now support session-level search_path changes.
Default admission_threshold changed from 2 to 1 - queries are now cached on first occurrence by default.
New mv_size_ratio setting (default 10) - controls the materialization size gate for shape-eligible queries. Adjustable at runtime via the HTTP admin API.
Additional details
Usage instructions
PgCache AMI Usage
PgCache is a transparent caching proxy for PostgreSQL. This AMI includes PgCache and an embedded PostgreSQL 18 cache database, managed as systemd services. On first boot, a bootstrap script fetches your database credentials from AWS SSM Parameter Store and starts the proxy.
Prerequisites
Origin PostgreSQL database with wal_level = logical enabled Database user with REPLICATION role attribute or superuser IAM role attached to the instance with ssm:GetParameter permission
Quick Start
- Store your database URL in SSM
aws ssm put-parameter --name "/pgcache/prod/upstream-url" \ --type SecureString \ --value "postgres://user:password@host:5432/dbname?sslmode=require"
- Launch with user-data
Pass a script that calls the bootstrap with your SSM prefix: #!/bin/bash /opt/pgcache/bootstrap.sh --ssm-prefix /pgcache/prod
- Connect your application
Use the instance's private IP on port 5432.
Use the same database credentials that you stored in SSM.
SSM parameters (under your prefix)
All parameter names below are relative to your SSM prefix (for example, /pgcache/prod).
upstream-url (Required): Origin database connection URL. Example name: /pgcache/prod/upstream-url
replication-url (Optional): Separate connection URL for CDC replication. Example name: /pgcache/prod/replication-url
tls-cert (Optional): PEM-encoded TLS certificate for client connections. Example name: /pgcache/prod/tls-cert
tls-key (Optional): PEM-encoded TLS private key for client connections. Example name: /pgcache/prod/tls-key
Bootstrap options
Non-secret settings can be passed as flags in user-data along with your SSM prefix:
/opt/pgcache/bootstrap.sh --ssm-prefix /pgcache/prod --workers 4 --cache-size 4294967296 --allowed-tables users,orders
Common flags:
--workers (default: half of vCPUs): Number of PgCache worker threads.
--cache-size (default: unlimited): Maximum cache size in bytes; enables eviction when set.
--cache-policy (default: clock): Eviction policy, one of "clock" or "fifo".
--admission-threshold (default: 2): Number of times a query must be seen before it is cached.
--allowed-tables (default: all): Comma-separated list of tables that may be cached.
--pinned-tables (default: none): Comma-separated list of tables that are always kept in cache.
--pinned-queries (default: none): Semicolon-separated list of queries that are always kept in cache.
Managing the service
Check status: sudo systemctl status pgcache
View logs: sudo journalctl -u pgcache -f
Edit config: sudo vi /etc/pgcache/config.toml
Restart after config changes: sudo systemctl restart pgcache
Metrics
Prometheus metrics endpoint: http://<instance>:9090/metrics
Ports
5432: PgCache proxy (configure access via security groups).
9090: Prometheus metrics (optional; restrict as needed).
5433: Embedded PostgreSQL (listens on localhost only, not externally accessible).
Security
Database credentials are stored in SSM SecureString parameters and fetched at boot, not passed in user-data.
The PgCache configuration file is readable only by root and the postgres user.
Restrict access to port 5432 to your application VPC or specific security group sources.
Further documentation
Full documentation, including advanced configuration, troubleshooting, and architecture details, is available at:
Support
Vendor support
contact aws-team@pgcache.com
AWS infrastructure support
AWS Support is a one-on-one, fast-response support channel that is staffed 24x7x365 with experienced and technical support engineers. The service helps customers of all sizes and technical abilities to successfully utilize the products and features provided by Amazon Web Services.