Build1 distinct publisher3 min readPublished
A side project put version 0.6.2 in front of a synthetic 16-million-row schema and got three dashboard aggregates under a millisecond, on data the author generated specifically to make the slow queries appear.
The Engineer · Build desk

Compiled by The EngineerSomething wrong?How this is made
Start with what the application sees. The connection string points at port 5432, PgCache answers the Postgres wire protocol, and the client cannot tell it is not talking to the database [1][8]. Behind that, the proxy holds a second connection open as a replication consumer. When the write-ahead log shows that rows behind a cached result changed, the result is refreshed instead of aged out [2][3].
That is the actual trade, and it is a trade rather than a win. A materialized view makes you pick a refresh interval and serve slightly stale numbers between refreshes; a Redis layer makes you write and maintain the code that knows which keys to drop on every write [18]. Replication-driven invalidation removes both, and puts freshness on how fast the proxy drains WAL, which is not a number you configure [23].
The database-side setup is two things: `wal_level = logical` and replication permission on the login role [9]. The author reports he started with a hand-written `pg_hba.conf` rule and a `CREATE PUBLICATION` line, then deleted both after checking that PgCache creates its own publication and slot at startup, scoped to just the four tables it caches, which he confirmed in `pg_publication` [10]. A tool that narrows its own publication to the tables it will actually serve is doing the polite thing rather than asking for the whole cluster. The replication connection authenticates with the ordinary password [11]. The one hard stop is memory: the cache lives in `/dev/shm`, and startup fails unless that mount is more than twice the proxy's internal `shared_buffers`, with the required size printed in the error [12]. A sizing requirement that tells you the number it wants is better than most.
Now the numbers, which are claims about someone else's workload. The harness runs four queries 150 times each at concurrency 10 against both targets after warming both, which is 1,200 statement executions in total [13][20]. Every one of the 150 proxy runs registered as a hit on PgCache's own counter [14]. Three of the four shapes improved and one did not [21]: the aggregates fall from hundreds or thousands of milliseconds to under one, roughly two to three orders of magnitude, while the already sub-millisecond point lookup just pays for an extra process hop [16][22][15].
For those to transfer, your read mix has to look like that harness: the same query text repeating often enough to stay resident, result sets that fit in shared memory, and a write rate low enough that refresh is not continuous. The data was seeded to about 16 million rows precisely so the slow queries would appear on demand, so cardinality and distribution are the author's choices [5][6]. To his credit, indexes went on every foreign key and every filtered or grouped column first, so the comparison is against a tuned Postgres [7].
The feature worth reading the docs on is predicate subsumption: a cached `WHERE country = 'US'` also answers `WHERE country = 'US' AND tier = 'pro'` [17]. That is query rewriting inside the proxy, not key lookup, and it means the correctness surface now includes the subsumption logic. The write-visibility test is the one that decides whether any of this is safe, and the copy of the post supplied to us stops as it begins [24][25].
Ranked by verification strength, evidence, and original report placement.
Instead of expiring entries on a timer, PgCache follows Postgres's replication stream and refreshes a cached result when the rows behind it change.
The replication stream PgCache follows is the same feed Postgres uses to copy data to a standby server: a running log of every insert, update and delete.
The author states that a fast cache that hands back stale rows is worse than no cache, calls this the test he cared about, and begins it by writing a new row straight to the origin Postgres.
PgCache is a proxy that talks the Postgres wire protocol, so the application connects to it as if it were the database, and it caches reads.
The author tested PgCache version 0.6.2, describes the write-up as a side project rather than a production story, and states he has no connection to PgCache.
The database used is synthetic data the author generated so the slow-query problem would show up on demand.
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · September 1, 2026
Follow any of these and your For You feed starts watching them — no settings page required.
build
Edge KV puts the permission check an hour behind the Postgres row1 distinct publisher
build
Path normalization strands the local storage backend under a root-owned /app1 distinct publisher
build
n8n's queue mode spends a second full process to absorb a peak of 19 jobs1 distinct publisher
build
Queueing the OpenAI call turns model latency into a polling problem1 distinct publisher
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Clonable, but one pair of hands
Everything traces to a single dev.to post by a developer who says in his first line that he has no tie to the project — and who then does the two things that make a solo test checkable: he indexes the synthetic schema on every foreign key and grouping column so the baseline isn't a strawman, and he prints the proxy's hit counter so a fast answer that quietly came from the database can't pass as a cache hit. What's absent is anyone else's arithmetic. The headline speedups arrive as 'hundreds or thousands of milliseconds to under one' on 16 million rows the author generated himself.
One clone of a demo repo
Adoption here begins and ends with a Docker Compose file: two containers, a generated database, version 0.6.2. Nobody in this reporting runs PgCache under real traffic, no organisation is named, and the single usage signal is an unaffiliated developer's side project that he labels as such.
The author argues against his own headline
The obvious way to oversell this — data built specifically so aggregates would crawl — is disclosed in the opening paragraph, and the query that got no faster was left in the results deliberately as the answer to 'does this speed up everything'. If anything the framing undersells the part that would matter in production: writes reaching cached reads inside a tenth of a second, with a cold-start window the author chased into the project's design notes rather than editing out.
No vendor in the room, but a platform that rewards posts
The author disclaims any relationship with PgCache and reaches for the project's documentation only to name behaviour he had already observed — predicate subsumption, ADR-035's watermark language. The residual pull is the genre rather than the money: dev.to rewards a clean before-and-after, and 'three dashboard queries went from seconds to sub-millisecond' is precisely that shape.
Believable mechanism, unreplicated numbers
The mechanism is easy to credit because it is verifiable in the small: logical replication turned on, a publication the proxy creates for itself over four tables, a slot visible in pg_publication. The numbers are another matter — one machine, one run, one dataset built for the purpose, and no account anywhere of what happens when the cache must hold real cardinality or when writes arrive faster than the proxy drains the log.