System View for Inspecting DSM Registry Allocations in PostgreSQL
9 months ago
- #Shared Memory
- #PostgreSQL
- #DSM Registry
- The dynamic shared memory (DSM) registry in PostgreSQL allows extensions and core components to allocate dynamic shared memory with a string name.
- PostgreSQL 17 initially supported DSM segment allocation via GetNamedDSMSegment.
- New variants GetNamedDSA() and GetNamedDSHash() simplify allocating Dynamic Shared Areas (DSA) and dynamic shared hash tables (dshash) within the DSM registry.
- A new system view, pg_dsm_registry_allocations, provides visibility into shared memory allocations tracked in the DSM registry.
- The view includes details like allocation name, type (segment, area, or hash), and size in bytes (for segments).
- The test_dsm_registry module serves as a usage example for these facilities.
- Both the new allocation helpers and the system view will be available in PostgreSQL 19 (expected Autumn 2026).
- Patches can be adapted for local builds if needed before PostgreSQL 19.