pg_local_cache
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_local_cache | 3.1.0 | FEAT | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2890 | pg_local_cache | No | Yes | Yes | Yes | No | No | local_cache |
PG14-18; requires preload.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 3.1.0 | 1817161514 | pg_local_cache | - |
| RPM | PIGSTY | 3.1.0 | 1817161514 | pg_local_cache_$v | openssl-libs |
| DEB | PIGSTY | 3.1.0 | 1817161514 | postgresql-$v-pg-local-cache | `libssl3 |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 2.0.4 el8.x86_64.pg18 : pg_local_cache_18 pg_local_cache_18-2.0.4-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.0.4 el8.x86_64.pg17 : pg_local_cache_17 pg_local_cache_17-2.0.4-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.0.4 el8.x86_64.pg16 : pg_local_cache_16 pg_local_cache_16-2.0.4-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.0.4 el8.x86_64.pg15 : pg_local_cache_15 pg_local_cache_15-2.0.4-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.0.4 el8.x86_64.pg14 : pg_local_cache_14 pg_local_cache_14-2.0.4-1PGSTY.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY 2.0.4 el8.aarch64.pg18 : pg_local_cache_18 pg_local_cache_18-2.0.4-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.0.4 el8.aarch64.pg17 : pg_local_cache_17 pg_local_cache_17-2.0.4-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.0.4 el8.aarch64.pg16 : pg_local_cache_16 pg_local_cache_16-2.0.4-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.0.4 el8.aarch64.pg15 : pg_local_cache_15 pg_local_cache_15-2.0.4-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.0.4 el8.aarch64.pg14 : pg_local_cache_14 pg_local_cache_14-2.0.4-1PGSTY.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY 2.0.4 el9.x86_64.pg18 : pg_local_cache_18 pg_local_cache_18-2.0.4-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.0.4 el9.x86_64.pg17 : pg_local_cache_17 pg_local_cache_17-2.0.4-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.0.4 el9.x86_64.pg16 : pg_local_cache_16 pg_local_cache_16-2.0.4-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.0.4 el9.x86_64.pg15 : pg_local_cache_15 pg_local_cache_15-2.0.4-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.0.4 el9.x86_64.pg14 : pg_local_cache_14 pg_local_cache_14-2.0.4-1PGSTY.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY 2.0.4 el9.aarch64.pg18 : pg_local_cache_18 pg_local_cache_18-2.0.4-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.0.4 el9.aarch64.pg17 : pg_local_cache_17 pg_local_cache_17-2.0.4-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.0.4 el9.aarch64.pg16 : pg_local_cache_16 pg_local_cache_16-2.0.4-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.0.4 el9.aarch64.pg15 : pg_local_cache_15 pg_local_cache_15-2.0.4-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.0.4 el9.aarch64.pg14 : pg_local_cache_14 pg_local_cache_14-2.0.4-1PGSTY.el9.aarch64.rpm
|
| el10.x86_64 | PIGSTY 2.0.4 el10.x86_64.pg18 : pg_local_cache_18 pg_local_cache_18-2.0.4-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.0.4 el10.x86_64.pg17 : pg_local_cache_17 pg_local_cache_17-2.0.4-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.0.4 el10.x86_64.pg16 : pg_local_cache_16 pg_local_cache_16-2.0.4-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.0.4 el10.x86_64.pg15 : pg_local_cache_15 pg_local_cache_15-2.0.4-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.0.4 el10.x86_64.pg14 : pg_local_cache_14 pg_local_cache_14-2.0.4-1PGSTY.el10.x86_64.rpm
|
| el10.aarch64 | PIGSTY 2.0.4 el10.aarch64.pg18 : pg_local_cache_18 pg_local_cache_18-2.0.4-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.0.4 el10.aarch64.pg17 : pg_local_cache_17 pg_local_cache_17-2.0.4-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.0.4 el10.aarch64.pg16 : pg_local_cache_16 pg_local_cache_16-2.0.4-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.0.4 el10.aarch64.pg15 : pg_local_cache_15 pg_local_cache_15-2.0.4-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.0.4 el10.aarch64.pg14 : pg_local_cache_14 pg_local_cache_14-2.0.4-1PGSTY.el10.aarch64.rpm
|
| d12.x86_64 | PIGSTY 2.0.4 d12.x86_64.pg18 : postgresql-18-pg-local-cache postgresql-18-pg-local-cache_2.0.4-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.0.4 d12.x86_64.pg17 : postgresql-17-pg-local-cache postgresql-17-pg-local-cache_2.0.4-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.0.4 d12.x86_64.pg16 : postgresql-16-pg-local-cache postgresql-16-pg-local-cache_2.0.4-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.0.4 d12.x86_64.pg15 : postgresql-15-pg-local-cache postgresql-15-pg-local-cache_2.0.4-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.0.4 d12.x86_64.pg14 : postgresql-14-pg-local-cache postgresql-14-pg-local-cache_2.0.4-1PGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY 2.0.4 d12.aarch64.pg18 : postgresql-18-pg-local-cache postgresql-18-pg-local-cache_2.0.4-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.0.4 d12.aarch64.pg17 : postgresql-17-pg-local-cache postgresql-17-pg-local-cache_2.0.4-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.0.4 d12.aarch64.pg16 : postgresql-16-pg-local-cache postgresql-16-pg-local-cache_2.0.4-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.0.4 d12.aarch64.pg15 : postgresql-15-pg-local-cache postgresql-15-pg-local-cache_2.0.4-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.0.4 d12.aarch64.pg14 : postgresql-14-pg-local-cache postgresql-14-pg-local-cache_2.0.4-1PGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY 2.0.4 d13.x86_64.pg18 : postgresql-18-pg-local-cache postgresql-18-pg-local-cache_2.0.4-1PGSTY~trixie_amd64.deb
| PIGSTY 2.0.4 d13.x86_64.pg17 : postgresql-17-pg-local-cache postgresql-17-pg-local-cache_2.0.4-1PGSTY~trixie_amd64.deb
| PIGSTY 2.0.4 d13.x86_64.pg16 : postgresql-16-pg-local-cache postgresql-16-pg-local-cache_2.0.4-1PGSTY~trixie_amd64.deb
| PIGSTY 2.0.4 d13.x86_64.pg15 : postgresql-15-pg-local-cache postgresql-15-pg-local-cache_2.0.4-1PGSTY~trixie_amd64.deb
| PIGSTY 2.0.4 d13.x86_64.pg14 : postgresql-14-pg-local-cache postgresql-14-pg-local-cache_2.0.4-1PGSTY~trixie_amd64.deb
|
| d13.aarch64 | PIGSTY 2.0.4 d13.aarch64.pg18 : postgresql-18-pg-local-cache postgresql-18-pg-local-cache_2.0.4-1PGSTY~trixie_arm64.deb
| PIGSTY 2.0.4 d13.aarch64.pg17 : postgresql-17-pg-local-cache postgresql-17-pg-local-cache_2.0.4-1PGSTY~trixie_arm64.deb
| PIGSTY 2.0.4 d13.aarch64.pg16 : postgresql-16-pg-local-cache postgresql-16-pg-local-cache_2.0.4-1PGSTY~trixie_arm64.deb
| PIGSTY 2.0.4 d13.aarch64.pg15 : postgresql-15-pg-local-cache postgresql-15-pg-local-cache_2.0.4-1PGSTY~trixie_arm64.deb
| PIGSTY 2.0.4 d13.aarch64.pg14 : postgresql-14-pg-local-cache postgresql-14-pg-local-cache_2.0.4-1PGSTY~trixie_arm64.deb
|
| u22.x86_64 | PIGSTY 2.0.4 u22.x86_64.pg18 : postgresql-18-pg-local-cache postgresql-18-pg-local-cache_2.0.4-1PGSTY~jammy_amd64.deb
| PIGSTY 2.0.4 u22.x86_64.pg17 : postgresql-17-pg-local-cache postgresql-17-pg-local-cache_2.0.4-1PGSTY~jammy_amd64.deb
| PIGSTY 2.0.4 u22.x86_64.pg16 : postgresql-16-pg-local-cache postgresql-16-pg-local-cache_2.0.4-1PGSTY~jammy_amd64.deb
| PIGSTY 2.0.4 u22.x86_64.pg15 : postgresql-15-pg-local-cache postgresql-15-pg-local-cache_2.0.4-1PGSTY~jammy_amd64.deb
| PIGSTY 2.0.4 u22.x86_64.pg14 : postgresql-14-pg-local-cache postgresql-14-pg-local-cache_2.0.4-1PGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY 2.0.4 u22.aarch64.pg18 : postgresql-18-pg-local-cache postgresql-18-pg-local-cache_2.0.4-1PGSTY~jammy_arm64.deb
| PIGSTY 2.0.4 u22.aarch64.pg17 : postgresql-17-pg-local-cache postgresql-17-pg-local-cache_2.0.4-1PGSTY~jammy_arm64.deb
| PIGSTY 2.0.4 u22.aarch64.pg16 : postgresql-16-pg-local-cache postgresql-16-pg-local-cache_2.0.4-1PGSTY~jammy_arm64.deb
| PIGSTY 2.0.4 u22.aarch64.pg15 : postgresql-15-pg-local-cache postgresql-15-pg-local-cache_2.0.4-1PGSTY~jammy_arm64.deb
| PIGSTY 2.0.4 u22.aarch64.pg14 : postgresql-14-pg-local-cache postgresql-14-pg-local-cache_2.0.4-1PGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY 2.0.4 u24.x86_64.pg18 : postgresql-18-pg-local-cache postgresql-18-pg-local-cache_2.0.4-1PGSTY~noble_amd64.deb
| PIGSTY 2.0.4 u24.x86_64.pg17 : postgresql-17-pg-local-cache postgresql-17-pg-local-cache_2.0.4-1PGSTY~noble_amd64.deb
| PIGSTY 2.0.4 u24.x86_64.pg16 : postgresql-16-pg-local-cache postgresql-16-pg-local-cache_2.0.4-1PGSTY~noble_amd64.deb
| PIGSTY 2.0.4 u24.x86_64.pg15 : postgresql-15-pg-local-cache postgresql-15-pg-local-cache_2.0.4-1PGSTY~noble_amd64.deb
| PIGSTY 2.0.4 u24.x86_64.pg14 : postgresql-14-pg-local-cache postgresql-14-pg-local-cache_2.0.4-1PGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY 2.0.4 u24.aarch64.pg18 : postgresql-18-pg-local-cache postgresql-18-pg-local-cache_2.0.4-1PGSTY~noble_arm64.deb
| PIGSTY 2.0.4 u24.aarch64.pg17 : postgresql-17-pg-local-cache postgresql-17-pg-local-cache_2.0.4-1PGSTY~noble_arm64.deb
| PIGSTY 2.0.4 u24.aarch64.pg16 : postgresql-16-pg-local-cache postgresql-16-pg-local-cache_2.0.4-1PGSTY~noble_arm64.deb
| PIGSTY 2.0.4 u24.aarch64.pg15 : postgresql-15-pg-local-cache postgresql-15-pg-local-cache_2.0.4-1PGSTY~noble_arm64.deb
| PIGSTY 2.0.4 u24.aarch64.pg14 : postgresql-14-pg-local-cache postgresql-14-pg-local-cache_2.0.4-1PGSTY~noble_arm64.deb
|
| u26.x86_64 | PIGSTY 2.0.4 u26.x86_64.pg18 : postgresql-18-pg-local-cache postgresql-18-pg-local-cache_2.0.4-1PGSTY~resolute_amd64.deb
| PIGSTY 2.0.4 u26.x86_64.pg17 : postgresql-17-pg-local-cache postgresql-17-pg-local-cache_2.0.4-1PGSTY~resolute_amd64.deb
| PIGSTY 2.0.4 u26.x86_64.pg16 : postgresql-16-pg-local-cache postgresql-16-pg-local-cache_2.0.4-1PGSTY~resolute_amd64.deb
| PIGSTY 2.0.4 u26.x86_64.pg15 : postgresql-15-pg-local-cache postgresql-15-pg-local-cache_2.0.4-1PGSTY~resolute_amd64.deb
| PIGSTY 2.0.4 u26.x86_64.pg14 : postgresql-14-pg-local-cache postgresql-14-pg-local-cache_2.0.4-1PGSTY~resolute_amd64.deb
|
| u26.aarch64 | PIGSTY 2.0.4 u26.aarch64.pg18 : postgresql-18-pg-local-cache postgresql-18-pg-local-cache_2.0.4-1PGSTY~resolute_arm64.deb
| PIGSTY 2.0.4 u26.aarch64.pg17 : postgresql-17-pg-local-cache postgresql-17-pg-local-cache_2.0.4-1PGSTY~resolute_arm64.deb
| PIGSTY 2.0.4 u26.aarch64.pg16 : postgresql-16-pg-local-cache postgresql-16-pg-local-cache_2.0.4-1PGSTY~resolute_arm64.deb
| PIGSTY 2.0.4 u26.aarch64.pg15 : postgresql-15-pg-local-cache postgresql-15-pg-local-cache_2.0.4-1PGSTY~resolute_arm64.deb
| PIGSTY 2.0.4 u26.aarch64.pg14 : postgresql-14-pg-local-cache postgresql-14-pg-local-cache_2.0.4-1PGSTY~resolute_arm64.deb
|
Build
You can build the RPM / DEB packages for pg_local_cache using pig build:
Install
You can install pg_local_cache directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
Sources:
- README.md
- pg_local_cache.control
- sql/pg_local_cache–3.1.0.sql
- sql/pg_local_cache–2.0.4–3.0.0.sql
- docs/UPGRADING.md
- CHANGELOG.md
- 3.0.0 to 3.1.0 upgrade
pg_local_cache 3.1.0 caches whole rows by their complete primary key in bounded shared memory. Cached reads now use authenticated RESP MGET; SQL local_cache.mget is removed and ordinary SELECT queries are not rewritten. PostgreSQL remains the durable source of truth.
Core Workflow
After authenticating the RESP connection:
Operational Boundaries
Append the library to existing preload entries, provision a dedicated worker role and its documented metadata/table grants, secure the token file, and restart. A superuser creates the extension in fixed schema local_cache. Attach only supported permanent primary-key tables. RESP MGET preserves order and duplicate keys and returns null for missing rows. Workers use the configured database role, not the client’s SQL privileges, transaction or snapshot. Keep joins, projections, row locks and session-sensitive reads in ordinary SQL.
local_cache.attach_table installs invalidation triggers; local_cache.detach_table removes a mapping; local_cache.reconcile_table revalidates it after DDL or privilege changes. local_cache.health, local_cache.stats and local_cache.metrics report readiness and resource use. Normal PostgreSQL writes invalidate affected cache entries. RLS, partitioned and inherited tables are outside the documented workload. There is no TTL or distributed cache coordination.
Supports PostgreSQL 14–18 on one writable primary. Non-loopback listeners require pg_local_cache.tls or explicit pg_local_cache.allow_plaintext_network opt-in. TLS uses separate certificate/key settings; a CA setting enables mutual TLS. The reloadable pg_local_cache.enabled switch disables caching.
Before upgrading from 2.x, move SQL MGET callers to the RESP authorization model. Install matching 3.1.0 files, configure listener security, restart, confirm the library version and listener readiness, then run ALTER EXTENSION pg_local_cache UPDATE in each affected database. Dependencies on removed functions or the replaced metrics return type can block migration; the script deliberately avoids CASCADE. No downgrade script is supplied.
Upgrade from 3.0.0 to 3.1.0
Version 3.1.0 changes the shared-memory layout and fixes stale-read races and worker memory leaks. Restart PostgreSQL after installing the matching library, then update the extension in each database; the SQL migration itself changes no objects or attached-table mappings. Verify pg_local_cache.binary_version and local_cache.health() afterward.
pg_local_cache.cache_entries now counts descriptors, while byte capacity comes from slab storage. Review pg_local_cache.lock_partitions, dirty-marker limits, the new pg_local_cache.max_deferred_misses, client slots and the process file-descriptor limit before restarting. MGET deduplicates misses, but single-flight waiters can use later transactions; a complete response is not guaranteed to share one snapshot.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)