Multiple sorts in a query

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Multiple sorts in a query
Дата
Msg-id 1242732733.14551.183.camel@ebony.2ndQuadrant
обсуждение исходный текст
Ответы Re: Multiple sorts in a query  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Multiple sorts in a query  (Greg Stark <stark@enterprisedb.com>)
Re: Multiple sorts in a query  (Chuck McDevitt <cmcdevitt@greenplum.com>)
Список pgsql-hackers
Just wanted to check some thoughts about how memory allocation works in
complex queries. Been thinking some more about recent Solaris testing
results that *seemed* to show issues with multiple concurrent queries
that have multiple sorts.

If we have a query that uses multiple sorts, we may have a top-level
sort, with child nodes that contain sorts also. In some cases we may
find with sub-nodes that have both inner and outer sub-trees that
contain sorts also.

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.)

When we later free() the memory, do we always free() it in the reverse
order in which it was allocated? If not, how does that effect reducing
the sbrk point, or other aspects of reusing allocated memory?

Is it possible that Solaris's default malloc isn't appropriate for
repeated use in complex queries that use multiple sorts?
http://developers.sun.com/solaris/articles/multiproc/multiproc.html
and recent OpenSolaris bug reports.

Anyway, feel free to jump in.

-- Simon Riggs           www.2ndQuadrant.comPostgreSQL Training, Services and Support



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Show method of index
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Multiple sorts in a query