Re: Automatically setting work_mem
От
Tom Lane
Тема
Re: Automatically setting work_mem
Дата
Msg-id
4329.1142981220@sss.pgh.pa.us
Ответ на
Re: Automatically setting work_mem (Martijn van Oosterhout)
Список
Дерево обсуждения
Re: Automatically setting work_mem "Qingqing Zhou" <zhouqq@cs.toronto.edu>
Re: Automatically setting work_mem Simon Riggs <simon@2ndquadrant.com>
Re: Automatically setting work_mem Tom Lane <tgl@sss.pgh.pa.us>
Re: Automatically setting work_mem Csaba Nagy <nagy@ecircle-ag.com>
Re: Automatically setting work_mem "Luke Lonergan" <llonergan@greenplum.com>
Re: Automatically setting work_mem Tom Lane <tgl@sss.pgh.pa.us>
Re: Automatically setting work_mem "Luke Lonergan" <llonergan@greenplum.com>
Re: Automatically setting work_mem Simon Riggs <simon@2ndquadrant.com>
Re: Automatically setting work_mem Thomas Hallgren <thomas@tada.se>
Re: Automatically setting work_mem Andreas Pflug <pgadmin@pse-consulting.de>
Re: Automatically setting work_mem Hannu Krosing <hannu@skype.net>
Re: Automatically setting work_mem Tom Lane <tgl@sss.pgh.pa.us>
Re: Automatically setting work_mem Martijn van Oosterhout <kleptog@svana.org>
Re: Automatically setting work_mem Simon Riggs <simon@2ndquadrant.com>
Re: Automatically setting work_mem Martijn van Oosterhout <kleptog@svana.org>
Re: Automatically setting work_mem Tom Lane <tgl@sss.pgh.pa.us>
Re: Automatically setting work_mem Simon Riggs <simon@2ndquadrant.com>
Re: [PATCHES] Automatically setting work_mem Simon Riggs <simon@2ndquadrant.com>
Re: [PATCHES] Automatically setting work_mem Simon Riggs <simon@2ndquadrant.com>
Re: [PATCHES] Automatically setting work_mem "Jim C. Nasby" <jnasby@pervasive.com>
Re: [PATCHES] Automatically setting work_mem Bruce Momjian <pgman@candle.pha.pa.us>
Re: [PATCHES] Automatically setting work_mem Simon Riggs <simon@2ndquadrant.com>
Re: [PATCHES] Automatically setting work_mem Tom Lane <tgl@sss.pgh.pa.us>
Re: [PATCHES] Automatically setting work_mem Simon Riggs <simon@2ndquadrant.com>
Re: [PATCHES] Automatically setting work_mem daveg <daveg@sonic.net>
Re: [PATCHES] Automatically setting work_mem David Fetter <david@fetter.org>
Re: [PATCHES] Automatically setting work_mem daveg <daveg@sonic.net>
Re: Automatically setting work_mem Bruno Wolff III <bruno@wolff.to>
Re: [PATCHES] Automatically setting work_mem "Jim C. Nasby" <jnasby@pervasive.com>
Re: Automatically setting work_mem "Luke Lonergan" <llonergan@greenplum.com>
Re: Automatically setting work_mem Tom Lane <tgl@sss.pgh.pa.us>
Re: Automatically setting work_mem "Luke Lonergan" <llonergan@greenplum.com>
Re: Automatically setting work_mem Josh Berkus <josh@agliodbs.com>
Re: Automatically setting work_mem Tom Lane <tgl@sss.pgh.pa.us>
Re: Automatically setting work_mem "Luke Lonergan" <llonergan@greenplum.com>
Martijn van Oosterhout writes: > There is one way to guarentee the memory is released to the OS after > completion. Make the allocator allocate work_mem bytes using mmap() > rather than malloc(). munmap() will then definitly return the memory to > the OS. Unfortunatly, the coding required would probably not be > straight-forward... Nor portable. > Glibc will only convert malloc() to an mmap() on > allocations > 128KB and I don't think PostgreSQL ever does that. Actually, we do: it doesn't take very long for the sequence of block allocations within a context to ramp up to 128K. (And I wouldn't be opposed to tweaking the logic in aset.c to make it happen faster, once an initial small allocation is filled up.) Also, individual chunk requests exceeding 8K or thereabouts are fed directly to malloc, so stuff like the SortTuple array might well be effectively mmap'd. I'm fairly unconvinced about Simon's underlying premise --- that we can't make good use of work_mem in sorting after the run building phase --- anyway. If we cut back our memory usage then we'll be forcing a significantly more-random access pattern to the temp file(s) during merging, because we won't be able to pre-read as much at a time. regards, tom lane
В списке pgsql-hackers по дате отправления