work_mem warriors - Jeff Davis & Melanie Plageman: PGCon 2020
Channel: PGCon
Date: 2020-12-12

From https://www.pgcon.org/events/pgcon_2020/schedule/session/50-work_mem-warriors-teaching-hashagg-hashjoin-and-other-memory-intensive-operators-to-respect-work_mems-boundaries/

Recent work on the Postgres executor has made improvements to memory management -- from accounting for the memory used to responding to memory pressure. It is important to bind the memory usage of the database with the appropriate execution mechanisms and to choose those during planning based on cost in order to meet users' expectations and ensure predictable performance.

This talk will cover three such improvements: the addition of memory accounting information to MemoryContexts, the memory-bounding of HashAgg (spilling HashAgg to disk), and the adaptive hashjoin fallback to nested hashloop join.

The talk will also include an interactive session to solicit feedback from users on their expectations and experiences with work_mem and the memory behavior of Postgres.