pganalyze reposted this
In today's 5mins of #Postgres we discuss tuning the "work_mem" setting in Postgres for a given workload - and why its not as simple to set as you might think (or as it should be!). The most important aspect that I had to re-discover when researching this episode: The work_mem setting in Postgres is effective on a per-query execution node (aka plan node) basis, not for the whole query. That means for a query that e.g. does multiple sort or hashing operations, you will see a multiple of work_mem being used. In the episode we showcase that with an example, using pg_log_backend_memory_contexts(..) to dump the memory usage of a given connection. We feature a post by Shaun Thomas on the Tembo blog last week, as well as a few mailing list discussions, and a good post from Christophe Pettus last year. https://lnkd.in/gkqApSX6