From: | "Pavan Deolasee" <pavan(dot)deolasee(at)gmail(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: stack usage in toast_insert_or_update() |
Date: | 2007-01-31 05:48:30 |
Message-ID: | 2e78013d0701302148s440b8849kae33c6ce4b5fb855@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 1/30/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "Pavan Deolasee" <pavan(dot)deolasee(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-01-31 06:48:44 | Re: stack usage in toast_insert_or_update() |
Previous Message | Bruce Momjian | 2007-01-31 04:24:10 | Re: PL/pgSQL RENAME functionality in TODOs |