Re: PL/pgSQL memory consumption?

From: "Peter Koczan" <pjkoczan(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Dawid Kuroczko" <qnex42(at)gmail(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: PL/pgSQL memory consumption?
Date: 2008-02-24 03:17:08
Message-ID: 4544e0330802231917x2045466s735989836698df2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, Feb 22, 2008 at 8:54 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Dawid Kuroczko" <qnex42(at)gmail(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2008-02-24 04:16:31 Re: PL/pgSQL memory consumption?
Previous Message Tena Sakai 2008-02-24 02:57:01 8.3.0 postinstallation trouble