On Sat, Jun 7, 2014 at 1:28 AM, Andres Freund <and...@2ndquadrant.com>
> On 2014-06-06 15:44:25 -0400, Tom Lane wrote:
> > I figured it'd be easy enough to get a better estimate by adding another
> > counter to count just LIVE and INSERT_IN_PROGRESS tuples (thus
> > assuming that in-progress inserts and deletes will both commit). I did
> > that, and found that it helped Tim's test case not at all :-(. A bit of
> > sleuthing revealed that HeapTupleSatisfiesVacuum actually returns
> > INSERT_IN_PROGRESS for any tuple whose xmin isn't committed, regardless
> > whether the transaction has since marked it for deletion:
> > /*
> > * It'd be possible to discern between INSERT/DELETE in
> > * here by looking at xmax - but that doesn't seem
> > * the majority of callers and even detrimental for some.
> > * rather have callers look at/wait for xmin than xmax. It's
> > * always correct to return INSERT_IN_PROGRESS because
> > * what's happening from the view of other backends.
> > */
> > return HEAPTUPLE_INSERT_IN_PROGRESS;
> That's only the case of a couple of days ago. I really wasn't sure
> wheter to go that way or discern the two cases. That changed in the wake
Won't this change impact the calculation of number of live
rows for analyze (acquire_sample_rows() considers the
HEAPTUPLE_DELETE_IN_PROGRESS tuples as liverows
for tuples updated by transactions other than current transaction)?
Even if we think that estimates are okay, the below comment
in acquire_same_rows() doesn't seem to suggest it.
* We count delete-in-progress rows as still live, using
* the same reasoning given above; but we don't bother to
* include them in the sample.