Re: Read Uncommitted

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Read Uncommitted
Date: 2008-05-27 17:52:58
Message-ID: 1211910778.4489.202.camel@ebony.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

As an addendum for the archives only, I would add:

On Sun, 2008-05-25 at 20:10 -0400, Tom Lane wrote:
> Simon Riggs <simon(at)2ndquadrant(dot)com> writes:

> > The implementation is trivial, namely that the calculation of global
> > xmin would ignore Read Uncommitted transactions.
>
> This proposed implementation seems to have very little to do with
> what most people would think Read Uncommitted does. In particular it
> does not agree with the SQL spec, which says that Read Uncommitted
> permits transactions to see the results of as-yet-uncommitted
> transactions. As an example, suppose that old transaction T1 reads
> a table that always contains exactly one live row, but T2 has modified
> that row since T1 started. Per spec what Read Uncommitted means is that
> T1 may see the modified version before T2 commits. This would not
> implement that behavior, though. What this implementation would mean is
> that after T2 commits, we might vacuum away the old version, causing T1
> to see *nothing* in the table:
>
> * T1 scans the new row version, doesn't return it because T2 not
> yet committed;
> * T2 commits;
> * VACUUM removes old row version;
> * T1 never finds old row version to return.
>
> Even if we thought that supporting Read Uncommitted would be a good
> idea, this would be an unacceptably unstable implementation of it.

We might think we can widen the snapshot so we see the new row versions
after update. That won't work either, because we don't check to see
whether multiple row versions are part of the same row. We always assume
that each row can have at most one visible row version for each
snapshot. So trying to see the new row versions instead would likely
result in viewing too many rows in most cases.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2008-05-27 18:00:28 Re: ERRORDATA_STACK_SIZE panic crashes on Windows
Previous Message Joshua D. Drake 2008-05-27 17:45:03 Re: ERRORDATA_STACK_SIZE panic crashes on Windows