Question About Serializable
От | Aaron Carlisle |
---|---|
Тема | Question About Serializable |
Дата | |
Msg-id | CAMSsDqXJDR3_mW1bSmT3rCCP6GvJqB+4Lh-oFHDatQRMHVn7fQ@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Question About Serializable
|
Список | pgsql-general |
The documentation states that "concurrent execution of a set of Serializable transactions is guaranteed to produce the same effect as running them one at a time in some order."
I'm not sure how the following behavior fits that definition. (Note that this is just an experiment, not a use case. Purely academic.) I run these transactions sequentially, and I get a different result than if I run them concurrently.This is in 9.3.0
create table x (value int);
Then I run the following transactions. If I run them sequentially, in either order, I get one row in table x. If I run them concurrently, I get no rows in x.
It seems like one of these should error out and not commit, so I must be missing some stipulation.
=========
begin;
set transaction isolation level serializable;
create table z ();
select pg_sleep(5);
insert into x (value)
select 0
where exists (select relname from pg_class
where relname = 'y')
and exists (select relname from pg_class
where relname = 'z');
commit;
=========
begin;
set transaction isolation level serializable;
create table y ();
select pg_sleep(5);
insert into x (value)
select 0
where exists (select relname from pg_class
where relname = 'y')
and exists (select relname from pg_class
where relname = 'z');
commit;
В списке pgsql-general по дате отправления: