You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support Unix domain sockets for the cache PostgreSQL connection #9
When pgcache and its cache PostgreSQL run on the same host or in the same container (e.g. the official Docker image), [cache] currently only supports host/port over TCP. Please consider allowing a Unix socket directory as cache.host (libpq convention: a value starting with /), keeping TCP loopback as the default.
Motivation
On a cache hit, every query already goes pgcache → cache PostgreSQL, so this hop is on the hot path of every hit and adds per-query latency.
Unix sockets skip the TCP stack and need no exposed port. Access can be restricted via filesystem permissions, and multiple instances on one host avoid port conflicts.
The gain is likely modest and workload-dependent, so I'd suggest benchmarking before committing.
Proposal
Accept a directory path in cache.host (and --cache_host); the socket file is /.s.PGSQL..
Unix-only; TCP stays the default and the fallback on other platforms.
Benchmark TCP loopback vs. Unix socket with a read-heavy workload (e.g. pgbench -S through pgcache), comparing p50/p99 latency and throughput.
Thanks again for your time and for the great work on pgcache!
Activity
philip-pgcache commentedon Nov 25, 2026
Well received and we're looking into it! Thanks for flagging this.