Re: Make MemoryContextMemAllocated() more precise
От
Jeff Davis
Тема
Re: Make MemoryContextMemAllocated() more precise
Дата
Msg-id
06b0ab6898b8f74e6e42e8ee944fdcd5bcd14ce1.camel@j-davis.com
Ответ на
Make MemoryContextMemAllocated() more precise (Jeff Davis)
Список
Дерево обсуждения
Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise Andres Freund <andres@anarazel.de>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise David Rowley <dgrowleyml@gmail.com>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise David Rowley <dgrowleyml@gmail.com>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise Daniel Gustafsson <daniel@yesql.se>
Re: Make MemoryContextMemAllocated() more precise Robert Haas <robertmhaas@gmail.com>
Re: Make MemoryContextMemAllocated() more precise Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: Make MemoryContextMemAllocated() more precise Robert Haas <robertmhaas@gmail.com>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise Robert Haas <robertmhaas@gmail.com>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
Re: Make MemoryContextMemAllocated() more precise Robert Haas <robertmhaas@gmail.com>
Re: Make MemoryContextMemAllocated() more precise Jeff Davis <pgsql@j-davis.com>
On Mon, 2020-03-16 at 11:45 -0700, Jeff Davis wrote: > Although that's technically correct, the purpose of > MemoryContextMemAllocated() is to give a "real" usage number so we > know > when we're out of work_mem and need to spill (in particular, the > disk- > based HashAgg work, but ideally other operators as well). This "real" > number should include fragmentation, freed-and-not-reused chunks, and > other overhead. But it should not include significant amounts of > allocated-but-never-touched memory, which says more about economizing > calls to malloc than it does about the algorithm's memory usage. To expand on this point: work_mem is to keep executor algorithms somewhat constrained in the memory that they use. With that in mind, it should reflect things that the algorithm has some control over, and can be measured cheaply. Therefore, we shouldn't include huge nearly-empty blocks of memory that the system decided to allocate in response to a request for a small chunk (the algorithm has little control). Nor should we try to walk a list of blocks or free chunks (expensive). We should include used memory, reasonable overhead (chunk headers, alignment, etc.), and probably free chunks (which represent fragmentation). For AllocSet, the notion of "all touched memory", which is everything except the current block's tail, seems to fit the requirements well. Regards, Jeff Davis
В списке pgsql-hackers по дате отправления