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

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: row-attribute in EXPLAIN-output doesn't match count(*)
Date: 2005-04-14 19:44:57
Message-ID: 8764ypf8hy.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Andrew Sullivan <ajs(at)crankycanuck(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Joseph Krogh 2005-04-14 19:57:03 Re: row-attribute in EXPLAIN-output doesn't match count(*)
Previous Message Andrew Sullivan 2005-04-14 19:08:18 Re: row-attribute in EXPLAIN-output doesn't match count(*)