Re: [PATCH] binary heap implementation

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: [PATCH] binary heap implementation
Дата
Msg-id CA+TgmoZURwA13OhpjVmUtkikqhsNBSNhoWa-qYTCuUETN=0rsg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] binary heap implementation  (Andres Freund <andres@2ndquadrant.com>)
Ответы Re: [PATCH] binary heap implementation  (Andres Freund <andres@2ndquadrant.com>)
Список pgsql-hackers
On Thu, Nov 15, 2012 at 11:22 AM, Andres Freund <andres@2ndquadrant.com> wrote:
> On 2012-11-14 18:41:12 +0530, Abhijit Menon-Sen wrote:
>> There are two or three places in the Postgres source that implement heap
>> sort (e.g. tuplesort.c, nodeMergeAppend.c), and it's also needed by the
>> BDR code. It seemed reasonable to factor out the functionality.
>
> pg_dump also contains a binary heap implementation if memory serves
> right which makes me wonder whether we should try binaryheap.[ch]
> backend clean... It currently uses palloc/pfree.
>
> Too bad we don't have a memory allocation routine which easily works in
> the backend and frontend... palloc references MemoryContextAlloc and
> CurrentMemoryContext so thats not that easy to emulate.

I think there's a clear need for a library of code that can be shared
by frontend and backend code.  I don't necessarily want to punt
everything into libpq, though.  What I wonder if we might do is create
something like src/lib/pgguts that contains routines for memory
allocation, error handling, stringinfos (so that you don't have to use
PQexpBuffer in the frontend and StringInfo in the backend), etc. and
make that usable by both front-end and back-end code.  I think that
would be a tremendously nice thing to have.

I don't think we should make it this patch's problem to do that, but
I'd be strongly in favor of such a thing if someone wants to put it
together.  It's been a huge nuisance for me in the past and all
indicates are that the work you're doing on LR is just going to
exacerbate that problem.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [PATCH 03/14] Add simple xlogdump tool
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [PATCH 03/14] Add simple xlogdump tool