From: | Simon Riggs <simon(at)2ndquadrant(dot)com> |
---|---|
To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
Cc: | Brad Nicholson <bnichols(at)ca(dot)afilias(dot)info>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Strange Behavior with Serializable Transcations |
Date: | 2006-06-29 12:21:19 |
Message-ID: | 1151583679.2749.7.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 2006-06-28 at 21:20 +0200, Martijn van Oosterhout wrote:
> On Wed, Jun 28, 2006 at 02:48:01PM -0400, Brad Nicholson wrote:
> > I'm seeing something fairly unintuitive about serializable transactions.
> >
> > Taking the following test case:
>
> <snip>
>
> > http://www.postgresql.org/docs/8.1/interactive/transaction-iso.html
> >
> > "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."
>
> I think the issue here is that transaction begin is not when you type
> "begin" but at your first actual query.
The issue is the difference between start of transaction and time when
the serializable snapshot is taken. Since BEGIN and other commands may
be issued as separate network requests it makes sense to defer taking
the snapshot until the first time it is needed. The transaction is still
serializable, just that the manual is worded slightly incorrectly with
regards the exact timing.
> You can obviously only start a
> transaction once you know what serialisation level you want, and you
> don't see that till after the begin.
Isolation level can be set on the BEGIN statement, so sometimes you do
know, but as mentioned above that's no reason to take the snapshot at
that point.
--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2006-06-29 12:27:30 | Re: Strange Behavior with Serializable Transcations |
Previous Message | lbolognini | 2006-06-29 11:54:40 | pg_restore: [archiver] could not open input file |