Commit 23c33198 authored by Bruce Momjian's avatar Bruce Momjian

docs: add "serialization anomaly" to transaction isolation table

Also distinguish between SQL-standard and Postgres behavior.

Report by David G. Johnston
parent c71e2734
...@@ -143,6 +143,20 @@ ...@@ -143,6 +143,20 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
serialization anomaly
<indexterm><primary>serialization anomaly</primary></indexterm>
</term>
<listitem>
<para>
The result of successfully committing a group of transactions
is inconsistent with all possible orderings of running those
transactions one at a time.
</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</para> </para>
...@@ -150,13 +164,13 @@ ...@@ -150,13 +164,13 @@
<indexterm> <indexterm>
<primary>transaction isolation level</primary> <primary>transaction isolation level</primary>
</indexterm> </indexterm>
The four transaction isolation levels and the corresponding The SQL standard and PostgreSQL-implemented transaction isolation levels
behaviors are described in <xref linkend="mvcc-isolevel-table">. are described in <xref linkend="mvcc-isolevel-table">.
</para> </para>
<table tocentry="1" id="mvcc-isolevel-table"> <table tocentry="1" id="mvcc-isolevel-table">
<title>Standard <acronym>SQL</acronym> Transaction Isolation Levels</title> <title>Transaction Isolation Levels</title>
<tgroup cols="4"> <tgroup cols="5">
<thead> <thead>
<row> <row>
<entry> <entry>
...@@ -171,6 +185,9 @@ ...@@ -171,6 +185,9 @@
<entry> <entry>
Phantom Read Phantom Read
</entry> </entry>
<entry>
Serialization Anomaly
</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
...@@ -178,6 +195,9 @@ ...@@ -178,6 +195,9 @@
<entry> <entry>
Read uncommitted Read uncommitted
</entry> </entry>
<entry>
Allowed, but not in PG
</entry>
<entry> <entry>
Possible Possible
</entry> </entry>
...@@ -202,6 +222,9 @@ ...@@ -202,6 +222,9 @@
<entry> <entry>
Possible Possible
</entry> </entry>
<entry>
Possible
</entry>
</row> </row>
<row> <row>
...@@ -214,6 +237,9 @@ ...@@ -214,6 +237,9 @@
<entry> <entry>
Not possible Not possible
</entry> </entry>
<entry>
Allowed, but not in PG
</entry>
<entry> <entry>
Possible Possible
</entry> </entry>
...@@ -232,27 +258,30 @@ ...@@ -232,27 +258,30 @@
<entry> <entry>
Not possible Not possible
</entry> </entry>
<entry>
Not possible
</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
<para> <para>
In <productname>PostgreSQL</productname>, you can request any of the In <productname>PostgreSQL</productname>, you can request any of
four standard transaction isolation levels. But internally, there are the four standard transaction isolation levels, but internally only
only three distinct isolation levels, which correspond to the levels Read three distinct isolation levels are implemented, i.e. PostgreSQL's
Committed, Repeatable Read, and Serializable. When you select the level Read Read Uncommitted mode behaves like Read Committed. This is because
Uncommitted you really get Read Committed, and phantom reads are not possible it is the only sensible way to map the standard isolation levels to
in the <productname>PostgreSQL</productname> implementation of Repeatable PostgreSQL's multiversion concurrency control architecture.
Read, so the actual </para>
isolation level might be stricter than what you select. This is
permitted by the SQL standard: the four isolation levels only <para>
define which phenomena must not happen, they do not define which The table also shows that PostgreSQL's Repeatable Read implementation
phenomena must happen. The reason that <productname>PostgreSQL</> does not allow phantom reads. Stricter behavior is permitted by the
only provides three isolation levels is that this is the only SQL standard: the four isolation levels only define which phenomena
sensible way to map the standard isolation levels to the multiversion must not happen, not which phenomena <emphasis>must</> happen.
concurrency control architecture. The behavior of the available The behavior of the available isolation levels is detailed in the
isolation levels is detailed in the following subsections. following subsections.
</para> </para>
<para> <para>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment