Re: Lazy Snapshots

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: "simon(at)2ndquadrant(dot)com" <simon(at)2ndquadrant(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Lazy Snapshots
Date: 2009-08-18 10:43:30
Message-ID: 4A8A85D2.5090206@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

simon(at)2ndquadrant(dot)com wrote:
> * Scan begins, no snapshot set. Ahead of scan a row that would have been visible
> at start of scan is deleted, commits and removed by VACUUM/HOT. The scan has no
> evidence that a removal has taken place, never sees contention and thus never
> takes a snapshot. This isn't a problem; the row removal created an implicit xmin
> for our scan. If we later took a snapshot the xmin of the snapshot would be
> equal or later than our previous implicit xmin and so MVCC would be working.
> This shows that it is wrong to presume that taking no snapshot at all means that
> the time consistent point on the scan was at the start of a statement, it may
> not be.

I don't understand this part. Imagine this:

Transaction A: start query "SELECT * FROM foo;"
Transaction B: BEGIN; DELETE FROM foo WHERE id = 1 OR id = 100000; COMMIT
Transaction A: query finishes.

How do you ensure that the query sees either both or neither of the
deleted tuples?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Kreen 2009-08-18 10:45:33 Re: COPY speedup
Previous Message simon@2ndquadrant.com 2009-08-18 10:13:08 Lazy Snapshots