Re: Synchronized scans - Mailing list pgsql-patches

From Tom Lane
Subject Re: Synchronized scans
Date
Msg-id 26655.1181316682@sss.pgh.pa.us
Whole thread Raw
In response to Re: Synchronized scans  (Heikki Linnakangas <heikki@enterprisedb.com>)
List pgsql-patches
Heikki Linnakangas <heikki@enterprisedb.com> writes:
> Tom Lane wrote:
>> It occurs to me that there's an actual bug here for catalog access.
>> The code assumes that it can measure rs_nblocks only once and not worry
>> about tuples added beyond that endpoint.  But this is only true when
>> using an MVCC-safe snapshot.

> You would only miss tuples inserted after you began the seqscan. After
> you've began the scan, you're going to miss any tuples that are inserted
> before the current position anyway, so stopping the scan early shouldn't
> do any real harm.

Good point.

> It would only be a problem if you do something like:
> heap_beginscan(...)
> Lock
> while(heap_getnext) ...
> Unlock
> And expect to see all tuples inserted before acquiring the lock.

But that could be fixed by taking the lock before the heap_beginscan.
Indeed it's hard to conceive of a situation where you'd want/need to
take the lock afterward; in most cases the beginscan and the actual
scan are right together.

So I withdraw this complaint; it's complexity we don't need.  I'll
add a comment about the point though.

            regards, tom lane

pgsql-patches by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Synchronized scans
Next
From: Tom Lane
Date:
Subject: Re: Synchronized scans