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 87fyxsehmz.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: row-attribute in EXPLAIN-output doesn't match count(*)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: row-attribute in EXPLAIN-output doesn't match count(*)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Tom Lane <tgl@sss.pgh.pa.us> writes:

> We have to start the transaction no later than event #2 since there has
> to be something to hold the lock.  But it'd be easy enough to decouple
> this from BEGIN, and it'd be good enough to solve the "COMMIT;BEGIN"
> problem.

Oh I think I finally figured out what you're saying here. 

So vacuum doesn't really know what tuples are actually visible to the
snapshots actually taken by a transaction? It's making the conservative
estimate that a snapshot could have been taken as early as the start of the
transaction even if no snapshot was taken until later?


> Which of these three times do you think now() ought to correspond to?
> I recall having argued that it should be event #3 since that corresponds
> to the database snapshot you see.  100% backwards compatibility would
> require setting now() at event #1, but will anyone weep if we change that?

I think it would be weird to perform a select and see records with dates after
now(). It would also be weird to perform a select and not see records inserted
before now(). I'm not sure any of the above guarantees those criteria for READ
COMMITTED mode, but I think I'm on the same general path as you.

-- 
greg



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: row-attribute in EXPLAIN-output doesn't match count(*)
Next
From: "Dinesh Pandey"
Date:
Subject: EXCEPTION handling in PL/pgSQL.