Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 922F99FB784 for ; Wed, 11 Apr 2007 10:34:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 95301-01-2 for ; Wed, 11 Apr 2007 10:34:23 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id 5173C9FB7EA for ; Wed, 11 Apr 2007 10:34:15 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1Hbcxh-0002VS-E1 for pgsql-sql@postgresql.org; Wed, 11 Apr 2007 09:34:13 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 01E843F9E; Wed, 11 Apr 2007 09:34:07 -0400 (EDT) Date: Wed, 11 Apr 2007 09:34:07 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: A long-running transaction Message-ID: <20070411133407.GB22510@phlogiston.dyndns.org> References: <461261AD.6060108@herakles.homelinux.org> <20070403201420.GB1519@phlogiston.dyndns.org> <461BBE33.9030807@herakles.homelinux.org> <20070410165523.GB20033@phlogiston.dyndns.org> <461C07A5.30000@herakles.homelinux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <461C07A5.30000@herakles.homelinux.org> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/114 X-Sequence-Number: 28114 On Wed, Apr 11, 2007 at 05:54:45AM +0800, John Summerfield wrote: > Linux caches writes, I don't think it should be hitting disk at all. The I _sure hope_ you don't care about this data, then. That's not a real safe way to work. But. . . > table being updated contains records 7482 (658K raw data) of which > probably fewer than 2000 are being updated, and typically the same ones > all the time: we're updating the date of the latest trade. . . . this is likely your problem. The updates probably get slower and slower. What's happening is that you're expiring a row _for each update_, which means it _isn't_ the same row every time. This is approximately the worst use model for PostgreSQL's MVCC approach. Worse, though it's not the same row, you have to grovel through all the dead rows to find the actually live one. So that's probably what's killing you. > Laptop (1.25 Gbytes) > shared_buffers = 1000 # min 16 or max_connections*2, > 8KB each so you have 8000 K configured as your shared buffers there. That's as much as you'll ever use for shared memory by Postgres. You can probably bump a little in this case. Your other config seems ok to me. But I don't think this is your problem -- the update pattern is. A -- Andrew Sullivan | ajs@crankycanuck.ca If they don't do anything, we don't need their acronym. --Josh Hamilton, on the US FEMA