Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id E841F2E0176 for ; Fri, 22 Feb 2008 09:23:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 81084-02 for ; Fri, 22 Feb 2008 09:23:37 -0400 (AST) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.155]) by postgresql.org (Postfix) with ESMTP id B86722E0143 for ; Fri, 22 Feb 2008 09:23:44 -0400 (AST) Received: by fg-out-1718.google.com with SMTP id 22so306555fge.23 for ; Fri, 22 Feb 2008 05:23:43 -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:mime-version:content-type:content-transfer-encoding:content-disposition; bh=aww7HUrofGKQlF42aG08X38CAZQrTwOeWaOfgAUOHkY=; b=KCeS1bYBSEnp6zmKAtiboWoDtBjZqxr/F+CF45UKV9pwuWRPZdkjfcdBQl0V3ZA+9+D++VRpW3E6DbMJ8IoYQlvmnrs2tzfGCzDVDo9T4FQMmyX8sJ7cExwqphrrXeTl64dQz+YVIgiCjk3n2f+7ESxZCQDwleblNakWGtGLm3g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=jzNEKQ9YuaUJgcDJD3Z+YcF9YrWZwqVKWw7MCukAooPWLgtbCOlmBVs+Ksek/pu2vGQHg+Q/wa1VPvg+7919j29uMnYI/jaVnkngIkq+QXgs+7Q14JZRKVPrOy3he63Dv2GQiPXhv8zTGMs4bGtki5tu05rs2+EaQGnRs4hu/78= Received: by 10.82.114.3 with SMTP id m3mr19442991buc.2.1203686622807; Fri, 22 Feb 2008 05:23:42 -0800 (PST) Received: by 10.82.186.16 with HTTP; Fri, 22 Feb 2008 05:23:42 -0800 (PST) Message-ID: <758d5e7f0802220523x12a444ap679e51b990190ccc@mail.gmail.com> Date: Fri, 22 Feb 2008 14:23:42 +0100 From: "Dawid Kuroczko" To: "pgsql-admin@postgresql.org" Subject: PL/pgSQL memory consumption? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/272 X-Sequence-Number: 28346 Hi there, 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? ;-)). For example: # sysctl -w|grep plpgsql.so|head -6 39048k: PID 23814 (/usr/lib/postgresql/8.2/lib/plpgsql.so) 38972k: PID 23815 (/usr/lib/postgresql/8.2/lib/plpgsql.so) 39048k: PID 23817 (/usr/lib/postgresql/8.2/lib/plpgsql.so) 39048k: PID 23822 (/usr/lib/postgresql/8.2/lib/plpgsql.so) 39048k: PID 23825 (/usr/lib/postgresql/8.2/lib/plpgsql.so) 39048k: PID 23835 (/usr/lib/postgresql/8.2/lib/plpgsql.so) Its an x86_64 platform, memory settings are: temp_buffers = 8MB work_mem = 8MB ...this does not include the plpgsql.so library, which is shared by all backends (which use PL/pgSQL). I know that system will eventually swap out unused parts, but then again, 40MB * number_of_connections is a bit wasteful. It seems to me that both temp_buffers and work_mem don't affect plpgsql.so's allocations. I wonder if this is something specific for my setup, or if not, can we reduce memory used a bit. Regards, Dawid PS: I am just starting research now, I thought other people's view is valuable.