Re: PL/pgSQL memory consumption? - Mailing list pgsql-admin

From Peter Koczan
Subject Re: PL/pgSQL memory consumption?
Date
Msg-id 4544e0330802231917x2045466s735989836698df2@mail.gmail.com
Whole thread Raw
In response to Re: PL/pgSQL memory consumption?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PL/pgSQL memory consumption?
List pgsql-admin
On Fri, Feb 22, 2008 at 8:54 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Dawid Kuroczko" <qnex42@gmail.com> writes:
>  > I have recently found a nice utility called memstat (which shows how
>  > much of private
>  > (not shared)) memory each process uses.  What kind of surprised me was
>  > the amount
>  > of memory that is used by PL/pgSQL (one more reason not to provide it
>  > by default? ;-)).
>
>  Why should we put any credence whatsoever in these numbers?
>  I rather doubt that "memstat" knows anything about our palloc
>  mechanism, so I don't see how it could possibly give reliable
>  answers about how much memory one portion or another of Postgres
>  is using.
>
>  Having said that, it would be interesting to know exactly what it
>  *is* measuring.

Correct me if I'm wrong, as well, but I believe that Linux (and
probably other modern Unices) does code-sharing, meaning that separate
processes referring to the same code/libraries will refer to the same
copy in physical memory.

So, even though each process is seeing 40 MB of libpgsql, there's
likely only 1 copy in physical memory. So, the total memory
consumption in the system from this library is 40 MB, not
40*num_processes MB.

Peter

pgsql-admin by date:

Previous
From: "Tena Sakai"
Date:
Subject: 8.3.0 postinstallation trouble
Next
From: Tom Lane
Date:
Subject: Re: PL/pgSQL memory consumption?