Re: Multiple sorts in a query

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Multiple sorts in a query
Дата
Msg-id 20090519114407.GB6215@svana.org
обсуждение исходный текст
Ответ на Multiple sorts in a query  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: Multiple sorts in a query  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-hackers
On Tue, May 19, 2009 at 12:32:13PM +0100, Simon Riggs wrote:
> If we allocate large chunks of memory we use malloc(). So complex
> queries can have multiple mallocs, followed by multiple reallocs. That
> in itself seems likely to end up with roughly double memory use, since
> realloc won't work properly/quickly with multiple mallocs. (Double since
> we allocate X bytes, then 2X bytes etc until we hit the limit.)

I don't know about Solaris, but glibc has a threshold above which it
starts using mmap() instead of sbrk(). Thus, once you start using very
large blocks, freeing always returns the memory to the kernel,
irrespective of other allocations.

The threshold is dynamic apparently, but starts at 128KB.

Just a thought,

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Multiple sorts in a query
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Multiple sorts in a query