On 1/30/07, Tom Lane <[EMAIL PROTECTED]> wrote:


"Pavan Deolasee" <[EMAIL PROTECTED]> 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

Reply via email to