From: | Florian Weimer <fw(at)deneb(dot)enyo(dot)de> |
---|---|
To: | "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PostgreSQL not ACID compliant? |
Date: | 2003-09-20 20:33:11 |
Message-ID: | 871xubmc8o.fsf@deneb.enyo.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"scott.marlowe" <scott(dot)marlowe(at)ihs(dot)com> writes:
> Postgresql supports Serializable transactions, which are 100% ACID
> compliant.
How can I activate it? 8-)
Yes, I know about SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, please
read on.
Given the two tables:
CREATE TABLE items (item INTEGER);
CREATE TABLE counts (count INTEGER);
And transactions following this pattern:
number := <some number>;
INSERT INTO items VALUES (number);
nr := SELECT COUNT(*) FROM items;
INSERT INTO counts VALUES (nr);
COMMIT;
If these transactions are executed serially, the following condition
always holds once the tables are non-empty:
(*) (SELECT COUNT(*) FROM items) = (SELECT MAX(count) FROM counts)
Now look at the following history:
Session 1 Session 2
number := <some number>;
number := <some number>;
INSERT INTO items VALUES (number);
INSERT INTO items VALUES (number);
nr := SELECT COUNT(*) FROM items;
nr := SELECT COUNT(*) FROM items;
INSERT INTO counts VALUES (nr);
INSERT INTO counts VALUES (nr);
COMMIT;
COMMIT;
If you enter these commands in two parallel psql sessions, in the
order indicated, condition (*) no longer holds once both transactions
are completed. Therefore, PostgreSQL must have generated a
non-serializable history.
Is this a bug, or is SQLxx serializability defined in different terms?
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-09-20 20:37:19 | Re: Can't Build 7.3.4 on OS X |
Previous Message | Gaetano Mendola | 2003-09-20 19:48:37 | Re: 7.4beta2 vs 7.3.3 |