Re: stack usage in toast_insert_or_update()

Поиск
Список
Период
Сортировка
От Pavan Deolasee
Тема Re: stack usage in toast_insert_or_update()
Дата
Msg-id 2e78013d0701302148s440b8849kae33c6ce4b5fb855@mail.gmail.com
обсуждение исходный текст
Ответ на Re: stack usage in toast_insert_or_update()  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: stack usage in toast_insert_or_update()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

On 1/30/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Pavan Deolasee" <pavan.deolasee@gmail.com> writes:
> The stack usage for toast_insert_or_update() may run into several KBs since
> the MaxHeapAttributeNumber is set to a very large value of 1600. The usage
> could anywhere between 28K to 48K depending on alignment and whether its a
> 32-bit or a 64-bit machine.

So?  The routine is not re-entrant so I don't see that the stack space
is a big problem.  It's coded that way to avoid palloc/pfree cycles...

I always thought that it would be costlier to have a repeated stack allocation/deallocation
of many KBs than dynamically allocating a small percentage of that. But I might be wrong.
In fact, a small test I ran showed that mallloc/free is more costly. So may be are
good.
 
Btw, I noticed that the toast_insert_or_update() is re-entrant. toast_save_datum()
calls simple_heap_insert() which somewhere down the line calls
toast_insert_or_update() again. It looks a bit surprising, haven't look into detail
though.

Thanks,
Pavan

--

EnterpriseDB     http://www.enterprisedb.com

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: PL/pgSQL RENAME functionality in TODOs
Следующее
От: Tom Lane
Дата:
Сообщение: Re: stack usage in toast_insert_or_update()