Re: row-attribute in EXPLAIN-output doesn't match count(*) - Mailing list pgsql-sql

From Greg Stark
Subject Re: row-attribute in EXPLAIN-output doesn't match count(*)
Date
Msg-id 8764ypf8hy.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: row-attribute in EXPLAIN-output doesn't match count(*)  (Andrew Sullivan <ajs@crankycanuck.ca>)
Responses Re: row-attribute in EXPLAIN-output doesn't match count(*)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: row-attribute in EXPLAIN-output doesn't match count(*)
Next
From: Andreas Joseph Krogh
Date:
Subject: Re: row-attribute in EXPLAIN-output doesn't match count(*)