Re: Question about the isolation level and visible

From: Xiang Gan <XiangGan(at)santaitech(dot)com>
To: 娄帅 <louis(dot)hust(dot)ml(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Question about the isolation level and visible
Date: 2015-06-26 01:59:52
Message-ID: C4174748BD0AE04EA243ED34FD0FADBB012A915D@STExchange.santai.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of 娄帅
Sent: Friday, June 26, 2015 9:12 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] Question about the isolation level and visible

Hi, all,

I start two session with the following execute time order:

session1: START TRANSACTION ISOLATION LEVEL SERIALIZABLE;

session2: INSERT INTO t1 values(1);
session2: COMMIT;

session1: SELECT * FROM t1;

I found session1 got the value 1 which is inserted by session2.

Is there any way to make session1 not see the value session2 inserted?

For mysql, I know there is a syntax:
START TRANSACTION WITH CONSISTENT SNAPSHOT.

I search the PG START syntax, but found none.

Any idea will be appreciated!

From this:

http://dev.mysql.com/doc/refman/5.6/en/commit.html

It seems that the WITH CONSISTENT SNAPSHOT modifier is only valid on isolation level REPEATABLE READ. But session1 is specified as on isolation level SERIALIZABLE. Thus, the provided scenario will get value 1 from session1 as I tested in MySQL. Can you describe the session scenarios more precisely?

--
With regards,
Xiang

In response to

Browse pgsql-general by date

  From Date Subject
Next Message litu16 2015-06-26 03:23:03 Re: Get the difference between two timestamp cells but in a special format in PostgreSQL
Previous Message Craig Ringer 2015-06-26 01:26:34 Re: BDR: Can a node live alone after being detached