X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CD624D79D9 for ; Sun, 6 Nov 2005 15:24:06 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30240-08 for ; Sun, 6 Nov 2005 19:24:04 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 8B573D6862 for ; Sun, 6 Nov 2005 15:24:05 -0400 (AST) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr2.postgresql.org (Postfix) with ESMTP id E0997F0B7D for ; Sun, 6 Nov 2005 19:24:05 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EYq7U-0003HY-00; Sun, 06 Nov 2005 14:24:00 -0500 To: "PostgreSQL" Cc: pgsql-performance@postgresql.org Subject: Re: 8.1 iss References: In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 06 Nov 2005 14:24:00 -0500 Message-ID: <87pspdfulr.fsf@stark.xeocode.com> Lines: 36 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.01 required=5 tests=[AWL=0.010] X-Spam-Score: 0.01 X-Spam-Level: X-Archive-Number: 200511/102 X-Sequence-Number: 15359 "PostgreSQL" writes: ... > As I post this, the query is approaching an hour of run time. I've listed > an explain of the query and my non-default conf parameters below. Please > advise on anything I should change or try, or on any information I can > provide that could help diagnose this. > > > GroupAggregate (cost=9899282.83..10285434.26 rows=223858 width=15) > Filter: (count(*) > 1) > -> Sort (cost=9899282.83..9994841.31 rows=38223392 width=15) > Sort Key: v_barcode > -> Seq Scan on lead (cost=0.00..1950947.92 rows=38223392 width=15) > > shared_buffers = 50000 > work_mem = 16384 ... It sounds to me like it's doing a large on-disk sort. Increasing work_mem should improve the efficiency. If you increase it enough it might even be able to do it in memory, but probably not. The shared_buffers is excessive but if you're using the default 8kB block sizes then it 400MB of shared pages on a 16GB machine ought not cause problems. It might still be worth trying lowering this to 10,000 or so. Is this a custom build from postgresql.org sources? RPM build? Or is it a BSD ports or Gentoo build with unusual options? Perhaps posting actual vmstat and iostat output might help if someone catches something you didn't see? -- greg