X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 457D75360F for ; Thu, 14 Apr 2005 16:45:11 -0300 (ADT) 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 51095-04 for ; Thu, 14 Apr 2005 19:45:06 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 987D153605 for ; Thu, 14 Apr 2005 16:45:05 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1DMAGo-0000Qs-00; Thu, 14 Apr 2005 15:44:58 -0400 To: Andrew Sullivan Cc: pgsql-sql@postgresql.org Subject: Re: row-attribute in EXPLAIN-output doesn't match count(*) References: <200504141838.14705.andreak@officenet.no> <425EA496.2030501@archonet.com> <200504141921.38476.andreak@officenet.no> <20050414173358.GB9027@phlogiston.dyndns.org> In-Reply-To: <20050414173358.GB9027@phlogiston.dyndns.org> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 14 Apr 2005 15:44:57 -0400 Message-ID: <8764ypf8hy.fsf@stark.xeocode.com> Lines: 22 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/210 X-Sequence-Number: 21103 Andrew Sullivan writes: > On Thu, Apr 14, 2005 at 07:21:38PM +0200, Andreas Joseph Krogh wrote: > > > > So, what you're suggesting is that a restart of the webapp should make vacuum > > able to delete those dead rows? > > Yes, but that'll only solve your problem for now. You'll have the > problem again soon. What's keeping open the transaction? This is presumably because of the long-standing issue that Postgres takes the snapshot as soon as the BEGIN is issued. A lot of drivers issue a "COMMIT; BEGIN;" right away even though it could be a long time before any actual work is done. Other databases (by which I mean Oracle) treat BEGIN as a noop. The snapshot starts when the first SQL statement that needs a snapshot is executed. So until a SELECT is issued the connection doesn't participate in any transactional issues like keeping old versions of records around. -- greg