Designing a monitoring feature in PostgreSQL
summary
Implements pg_get_process_memory_contexts(pid, get_summary, timeout) to fetch on‑demand per‑process memory context stats by sending a signal and waiting on a signal + condition variable + LWLock handshake; stores variable data in DSM/DSA with dsa_allocate/dsa_pin segments, aggregates overflow into a single cumulative line to cap RAM, and traverses contexts breadth‑first. Output includes total_bytes, free_bytes, free_chunks, num_agg_contexts and path; demo shows get_summary=true collapsing deeper nodes (CacheMemoryContext aggregates 98 contexts) and the feature returns useful live snapshots with tunable latency/memory tradeoffs.
AI-written summary · about
chapters (8)
- 0:00Introduction and agenda
- 1:06Types of monitoring systems
- 4:12Components of a monitoring feature
- 6:17Need for monitoring of memory contexts statistics
- 10:31Explanation of DSM and CSA
- 15:44Details of memory context statistics monitoring feature
- 19:41Design iterations of memory contexts monitoring feature
- 23:20Memory contexts monitoring function signature and output
related talks
32mDesigning and implementing a monitoring feature in PostgreSQL
31mAll in a context!
45mEnhancing PostgreSQL Plasticity: New Frontiers in Memory Management
51mHow to improve PostgreSQL Monitoring and ...
56mPostgreSQL at low Level: stay curious!
53mThe Future of Observability in Postgres
32mMonitoring Waits in PostgreSQL
50mHow To Improve PostgreSQL Monitoring and Observability With PMM - Part 2
