Skip to content

Commit 23c3319

Browse files
committed
docs: add "serialization anomaly" to transaction isolation table
Also distinguish between SQL-standard and Postgres behavior. Report by David G. Johnston
1 parent c71e273 commit 23c3319

File tree

1 file changed

+48
-19
lines changed

1 file changed

+48
-19
lines changed

doc/src/sgml/mvcc.sgml

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,34 @@
143143
</para>
144144
</listitem>
145145
</varlistentry>
146+
147+
<varlistentry>
148+
<term>
149+
serialization anomaly
150+
<indexterm><primary>serialization anomaly</primary></indexterm>
151+
</term>
152+
<listitem>
153+
<para>
154+
The result of successfully committing a group of transactions
155+
is inconsistent with all possible orderings of running those
156+
transactions one at a time.
157+
</para>
158+
</listitem>
159+
</varlistentry>
146160
</variablelist>
147161
</para>
148162

149163
<para>
150164
<indexterm>
151165
<primary>transaction isolation level</primary>
152166
</indexterm>
153-
The four transaction isolation levels and the corresponding
154-
behaviors are described in <xref linkend="mvcc-isolevel-table">.
167+
The SQL standard and PostgreSQL-implemented transaction isolation levels
168+
are described in <xref linkend="mvcc-isolevel-table">.
155169
</para>
156170

157171
<table tocentry="1" id="mvcc-isolevel-table">
158-
<title>Standard <acronym>SQL</acronym> Transaction Isolation Levels</title>
159-
<tgroup cols="4">
172+
<title>Transaction Isolation Levels</title>
173+
<tgroup cols="5">
160174
<thead>
161175
<row>
162176
<entry>
@@ -171,13 +185,19 @@
171185
<entry>
172186
Phantom Read
173187
</entry>
188+
<entry>
189+
Serialization Anomaly
190+
</entry>
174191
</row>
175192
</thead>
176193
<tbody>
177194
<row>
178195
<entry>
179196
Read uncommitted
180197
</entry>
198+
<entry>
199+
Allowed, but not in PG
200+
</entry>
181201
<entry>
182202
Possible
183203
</entry>
@@ -202,6 +222,9 @@
202222
<entry>
203223
Possible
204224
</entry>
225+
<entry>
226+
Possible
227+
</entry>
205228
</row>
206229

207230
<row>
@@ -214,6 +237,9 @@
214237
<entry>
215238
Not possible
216239
</entry>
240+
<entry>
241+
Allowed, but not in PG
242+
</entry>
217243
<entry>
218244
Possible
219245
</entry>
@@ -232,27 +258,30 @@
232258
<entry>
233259
Not possible
234260
</entry>
261+
<entry>
262+
Not possible
263+
</entry>
235264
</row>
236265
</tbody>
237266
</tgroup>
238267
</table>
239268

240269
<para>
241-
In <productname>PostgreSQL</productname>, you can request any of the
242-
four standard transaction isolation levels. But internally, there are
243-
only three distinct isolation levels, which correspond to the levels Read
244-
Committed, Repeatable Read, and Serializable. When you select the level Read
245-
Uncommitted you really get Read Committed, and phantom reads are not possible
246-
in the <productname>PostgreSQL</productname> implementation of Repeatable
247-
Read, so the actual
248-
isolation level might be stricter than what you select. This is
249-
permitted by the SQL standard: the four isolation levels only
250-
define which phenomena must not happen, they do not define which
251-
phenomena must happen. The reason that <productname>PostgreSQL</>
252-
only provides three isolation levels is that this is the only
253-
sensible way to map the standard isolation levels to the multiversion
254-
concurrency control architecture. The behavior of the available
255-
isolation levels is detailed in the following subsections.
270+
In <productname>PostgreSQL</productname>, you can request any of
271+
the four standard transaction isolation levels, but internally only
272+
three distinct isolation levels are implemented, i.e. PostgreSQL's
273+
Read Uncommitted mode behaves like Read Committed. This is because
274+
it is the only sensible way to map the standard isolation levels to
275+
PostgreSQL's multiversion concurrency control architecture.
276+
</para>
277+
278+
<para>
279+
The table also shows that PostgreSQL's Repeatable Read implementation
280+
does not allow phantom reads. Stricter behavior is permitted by the
281+
SQL standard: the four isolation levels only define which phenomena
282+
must not happen, not which phenomena <emphasis>must</> happen.
283+
The behavior of the available isolation levels is detailed in the
284+
following subsections.
256285
</para>
257286

258287
<para>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy