Re: Transaction isolation levels

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Geert Jansen <geert(at)boskant(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Transaction isolation levels
Date: 2005-07-09 13:02:40
Message-ID: 20050709130239.GA36376@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jul 09, 2005 at 01:18:09PM +0200, Geert Jansen wrote:
>
> The top of section 12.2 of the manual tells that nonrepeatable reads may
> happen in the 'read committed' isolation level. I can understand the
> above behaviour in terms of this. However, the start of section 12.2.1
> tells that in read committed mode, you get a snapshot of the database
> when the transaction starts, and that snapshot will not inlude committed
> changes from other transactions. Who is right here?

What words in section 12.2.1 are you referring to? I see the
following (emphasis mine):

In effect, a SELECT query sees a snapshot of the database as of
the instant that that *query* begins to run. Notice that two
successive SELECT commands can see different data, even though
they are within a single transaction, if other transactions commit
changes during execution of the first SELECT.

And later (emphasis mine):

Since in Read Committed mode each new *command* starts with a new
snapshot that includes all transactions committed up to that
instant, subsequent commands in the same transaction will see the
effects of the committed concurrent transaction in any case.

Perhaps you're reading 12.2.2 on Serializable (again, emphasis mine):

When a transaction is on the serializable level, a SELECT query
sees only data committed before the *transaction* began; it never
sees either uncommitted data or changes committed during transaction
execution by concurrent transactions....This is different from
Read Committed in that the SELECT sees a snapshot as of the start
of the *transaction*, not as of the start of the current query
within the transaction.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2005-07-09 13:49:04 Re: index usage in multi-column ORDER BY
Previous Message Michael Fuhr 2005-07-09 12:06:06 Re: PL/pgGRESQL, SHA, BYTEA - Creating SHA1 hash for Bytea Value in stored procedure