Created by Christian Köberl, May 2013
Dirty | Non-repeatable reads | Phantom reads | |
---|---|---|---|
Read uncommited | may occur | may occur | may occur |
Read commited | - | may occur | may occur |
Repeatable read | - | - | may occur |
Serializable | - | - | - |
Customer A
Customer B
SELECT *
FROM Thing
JOIN Thing_Tag
ON Thing.Id = Thing_Tag.Thing_Id
JOIN Tag
ON Tag.Id = Thing_Tag.Tag_Id
WHERE Tag.Tag = 'Java'
SELECT *
FROM Thing
JOIN Thing_Tag tt1
ON Thing.Id = tt1.Thing_Id
JOIN Thing_Tag tt2
ON Thing.Id = tt2.Thing_Id
JOIN Tag tag1
ON tag1.Id = tt1.Tag_Id
JOIN Tag tag2
ON tag2.Id = tt2.Tag_Id
WHERE tt1.Tag = 'Java' AND tt2.Tag = 'SQL'
SELECT *
FROM Thing
JOIN Thing_Tag
ON Thing.Id = Thing_Tag.Thing_Id
JOIN Tag
ON Tag.Id = Thing_Tag.Tag_Id
WHERE Tag.Tag = 'Java' OR Tag.Tag = 'SQL'
+ eliminate duplicate entries
SELECT *
FROM Thing
JOIN Thing_Tag
ON Thing.Id = Thing_Tag.Thing_Id
JOIN Tag
ON Tag.Id = Thing_Tag.Tag_Id
WHERE Tag.Tag = 'Java'
AND NOT EXISTS
(SELECT 1
FROM Thing_Tag
JOIN Tag
ON Tag.Id = Thing_Tag.Tag_Id
WHERE Thing_Tag.Thing_Id = Thing.Id
AND Tag.Tag = 'SQL')
tag:Java
tag:Java AND tag:SQL
tag:Java OR tag:SQL
tag:Java -tag:SQL
or the problem with ACID
It is impossible in the asynchronous network model to implement a read/write data object that guarantees the following properties:
- Availability
- Atomic consistency
in all fair executions (including those in which messages are lost).
all nodes see the same data at the same time
guarantee that every request receives a response about whether it was successful or failed
the system continues to operate despite arbitrary message loss or failure of part of the system