PostgreSQL Conference Germany
Die Deutsche PostgreSQL Konferenz
2025

Schedule - PGConf.DE 2025

PostgreSQL Connections Memory Usage: How Much, Why and When?

Date: 2025-05-09
Time: 11:10–11:55
Room: Ballsaal 2
Level: Intermediate

This talk explores the memory usage of PostgreSQL connections on Debian/Ubuntu running on x86–64 architecture. It gives an overview of memory management concepts, explaining key metrics like virtual, resident, and proportional memory sizes. It also covers various Linux tools for displaying memory usage.

The second part presents practical measurements of PostgreSQL memory usage, based on data from /proc/PID/smaps. It explains why RSS numbers for PostgreSQL connections appear so large after query execution and demonstrates that the actual unique memory usage is only a few dozen megabytes.

Finally, the talk examines how PostgreSQL connections allocate and release additional memory during query processing. It also clarifies where work_mem fits into these numbers and visualizes the process with plots.

Key Takeaways:

Speaker

Josef Machytka