pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dawid Kuroczko <qnex42@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: PL/pgSQL memory consumption?
Date: Mon, 25 Feb 2008 01:49:33 +0100
Message-ID: <758d5e7f0802241649t2e223675n3e59254c300d9cae@mail.gmail.com> (raw)
In-Reply-To: <3216.1203692055@sss.pgh.pa.us>
References: <758d5e7f0802220523x12a444ap679e51b990190ccc@mail.gmail.com>
	<3216.1203692055@sss.pgh.pa.us>

On Fri, Feb 22, 2008 at 3:54 PM, Tom Lane <tgl@sss.pgh.pa.us> wrot>
"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? ;-)).

I am sorry it took me so much time to respond, but was out-of-reach-of-PC
on the weekend.

>  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.

What memstat [1] is doing, is that it is loading /proc/<PID>/maps
files to determine
shared objects and private memory.

What I have nailed down was that the 40MBs worth of RAM were actually
an effect of
  PERFORM set_curdict('pl_ispell');
...from within PL/pgSQL function.

...if I wrap set_curdict(...) within SQL (CREATE FUNCTION ... LANGUAGE SQL), the
allocation is rightly attributed to tsearch2.so.

Regards,
    Dawid

[1]: http://packages.debian.org/etch/memstat
PS: I wonder what can I do to lower the memory used by tsearch2.  I
see a few options
like transaction-level pooling by pgBouncer or writing Polish snowball stemmer.
PPS: I like this memstat utility more and more -- appears to be a
helpful little utility.



view thread (5+ messages)

Message-ID: <758d5e7f0802241649t2e223675n3e59254c300d9cae@mail.gmail.com>
Permalink:  ../758d5e7f0802241649t2e223675n3e59254c300d9cae@mail.gmail.com/
Also on:    postgresql.org/message-id/758d5e7f0802241649t2e223675n3e59254c300d9cae@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: qnex42@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: PL/pgSQL memory consumption?
  In-Reply-To: <758d5e7f0802241649t2e223675n3e59254c300d9cae@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox