Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D5080633DA0 for ; Sat, 27 Feb 2010 19:25:39 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 53571-06 for ; Sat, 27 Feb 2010 23:25:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gx0-f227.google.com (mail-gx0-f227.google.com [209.85.217.227]) by mail.postgresql.org (Postfix) with ESMTP id 86FD8633D97 for ; Sat, 27 Feb 2010 19:25:28 -0400 (AST) Received: by gxk27 with SMTP id 27so834061gxk.1 for ; Sat, 27 Feb 2010 15:25:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=+ng3z1f0nUjiVZACzewlQ5hYGcyi8Y4F6oCIq90mZhA=; b=abfjplp/8CSARPZK3b91/9ARMKYVRZvXuaxoU9uxaxGVcEPfXHFgN9p9T5aqQUYewm 2/e0zi5xRfCQTZfwXhzXZNC6i+a7x0NTazQPgki1HMceMtdkc2/ZTRO8OnGT0YQ8f5+3 iW9eMHMoQj0IlaP9LXsN2/SsKs1ow2hLgpXEU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=hIZI/1tWIqcuZjw2Ju33qjtnLBZxZxCviRQkQr36/2itHK4WFbEmyucUP9fmjZsk9Q GzlzCM/6pXT1jWkKz5qTTgh28enllqFH0qTWKTHj76I/PwKIE5SmrDOFHSaPuDYt3AIx WcIl/wv05jol5OW7UKyjsJgGy8FCyZ5GTfT+Q= MIME-Version: 1.0 Received: by 10.90.18.33 with SMTP id 33mr2051037agr.12.1267313126308; Sat, 27 Feb 2010 15:25:26 -0800 (PST) In-Reply-To: References: <57033cf81002271429wb0da13am37b3cb6258103ea5@mail.gmail.com> Date: Sat, 27 Feb 2010 16:25:26 -0700 Message-ID: <57033cf81002271525w3bddc0acn63a5fd3f649068d4@mail.gmail.com> Subject: Re: How to troubleshoot high mem usage by postgres? From: Chris To: pgsql-performance@postgresql.org Content-Type: text/plain; charset=UTF-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/394 X-Sequence-Number: 37815 On Sat, Feb 27, 2010 at 3:38 PM, Ben Chobot wrote: > In your postgresql.conf file, what are the settings for work_mem and > shared_buffers? I have not done any tuning on this db yet (it is a dev box). It is using defaults. shared_buffers = 32MB #work_mem = 1MB I do appreciate the several quick responses and I will work on responding to the them. @Craig Ringer: select version() reports: PostgreSQL 8.4.2 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42), 64-bit The system has 4GB of RAM. The postgres log currently does not show any useful information. Only thing in there for today is an "Unexpected EOF on client connection" because I killed the process after it started swapping. The test input for my PHP script is a csv file with about 450,000 records in it. The php script processes the each csv record in a transaction, and on average it executes 2 insert or update statements per record. I don't think the specific statements executed are relevant (they are just basic INSERT and UPDATE statements). I will try to come up with a short script that reproduces the problem. @Tom Lane: As I mentioned above I am not doing everything in a single transaction. However I do want to try your suggestion regarding getting a "memory context map". But I'm afraid I don't know how to do what you are describing. How can I set the ulimit of postmaster? And does the postmaster stderr output go to the postgres log file? If not, where can I find it? Thanks again, Chris