Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AD6182E0042 for ; Sun, 24 Feb 2008 20:49:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 81626-09 for ; Sun, 24 Feb 2008 20:49:35 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.190]) by postgresql.org (Postfix) with ESMTP id 0393F2E0045 for ; Sun, 24 Feb 2008 20:49:34 -0400 (AST) Received: by fk-out-0910.google.com with SMTP id b27so1756777fka.3 for ; Sun, 24 Feb 2008 16:49:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=TpaFoS2e1i5448LAXqMtl5oygKgm45Ez0q9QIxFRQvw=; b=UkMLWo0JRMRfLXOLg2hmc2zsKaQpzmvmfnJVB5eympjaS4Rx1EMpJKi3QRfhsvnpkt7AcnWZ9GxEDBjVyYxasoomWO+zUTARCgQw0b3JEKIrxUrBsIKWVkBefjPlWGegJpHfMefkUM9yzuJKu+xjq65mBs5jOYNmhk9hp7Glbwk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VmD+CyBGWAmLZmqfIZ3uhRtSbfCv9A60DqguGcgmKxOSb94NUBb5Njyp8oUKjW//zSKX16I5GQZm7QAik9tYHlz7tzNdyWN1/ggJDsEoCgimCsvzBHEnwmdFxhJ/k1ilcP5O2zYSxmircjStLQcHig+FvQj24Oy/8oQ0vfs9pOU= Received: by 10.82.112.3 with SMTP id k3mr4439665buc.33.1203900573213; Sun, 24 Feb 2008 16:49:33 -0800 (PST) Received: by 10.82.186.16 with HTTP; Sun, 24 Feb 2008 16:49:33 -0800 (PST) Message-ID: <758d5e7f0802241649t2e223675n3e59254c300d9cae@mail.gmail.com> Date: Mon, 25 Feb 2008 01:49:33 +0100 From: "Dawid Kuroczko" To: "Tom Lane" Subject: Re: PL/pgSQL memory consumption? Cc: "pgsql-admin@postgresql.org" In-Reply-To: <3216.1203692055@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <758d5e7f0802220523x12a444ap679e51b990190ccc@mail.gmail.com> <3216.1203692055@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/302 X-Sequence-Number: 28376 On Fri, Feb 22, 2008 at 3:54 PM, Tom Lane wrot> "Dawid Kuroczko" 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//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.