pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: Andrew Sullivan <ajs@crankycanuck.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: row-attribute in EXPLAIN-output doesn't match count(*)
Date: 14 Apr 2005 15:44:57 -0400
Message-ID: <8764ypf8hy.fsf@stark.xeocode.com> (raw)
In-Reply-To: <20050414173358.GB9027@phlogiston.dyndns.org>
References: <200504141838.14705.andreak@officenet.no>
	<425EA496.2030501@archonet.com>
	<200504141921.38476.andreak@officenet.no>
	<20050414173358.GB9027@phlogiston.dyndns.org>

Andrew Sullivan <ajs@crankycanuck.ca> 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




view thread (24+ messages)  latest in thread

Message-ID: <8764ypf8hy.fsf@stark.xeocode.com>
Permalink:  ../8764ypf8hy.fsf@stark.xeocode.com/
Also on:    postgresql.org/message-id/8764ypf8hy.fsf@stark.xeocode.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gsstark@mit.edu, ajs@crankycanuck.ca
  Subject: Re: row-attribute in EXPLAIN-output doesn't match count(*)
  In-Reply-To: <8764ypf8hy.fsf@stark.xeocode.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox