mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Implement isolation levels read uncommitted and repeatable read as acting
like the next higher one.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.40 2003/11/04 09:55:38 petere Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.41 2003/11/06 22:08:14 petere Exp $
|
||||
-->
|
||||
|
||||
<chapter id="mvcc">
|
||||
@ -206,8 +206,25 @@ $Header: /cvsroot/pgsql/doc/src/sgml/mvcc.sgml,v 2.40 2003/11/04 09:55:38 petere
|
||||
</table>
|
||||
|
||||
<para>
|
||||
<productname>PostgreSQL</productname>
|
||||
offers the Read Committed and Serializable isolation levels.
|
||||
In <productname>PostgreSQL</productname>, you can use all four
|
||||
possible transaction isolation levels. Internally, there are only
|
||||
two distinct isolation levels, which correspond to the levels Read
|
||||
Committed and Serializable. When you select the level Read
|
||||
Uncommitted you really get Read Committed, and when you select
|
||||
Repeatable Read you really get Serializable, so the actual
|
||||
isolation level may be stricter than what you select. This is
|
||||
permitted by the SQL standard: the four isolation levels only
|
||||
define which phenomena must not happen, they do not define which
|
||||
phenomena must happen. The reason that PostgreSQL only provides
|
||||
two isolation levels is that this is the only sensible way to map
|
||||
the isolation levels to the multiversion concurrency control
|
||||
architecture. The behavior of the available isolation levels is
|
||||
detailed in the following subsections.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To set the transaction isolation level of a transaction, use the
|
||||
command <xref linkend="sql-set-transaction">.
|
||||
</para>
|
||||
|
||||
<sect2 id="xact-read-committed">
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_transaction.sgml,v 1.17 2003/09/11 21:42:20 momjian Exp $ -->
|
||||
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/set_transaction.sgml,v 1.18 2003/11/06 22:08:14 petere Exp $ -->
|
||||
<refentry id="SQL-SET-TRANSACTION">
|
||||
<refmeta>
|
||||
<refentrytitle id="SQL-SET-TRANSACTION-TITLE">SET TRANSACTION</refentrytitle>
|
||||
@ -17,9 +17,12 @@
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
SET TRANSACTION
|
||||
[ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]
|
||||
[ ISOLATION LEVEL { READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE } ]
|
||||
[ READ WRITE | READ ONLY ]
|
||||
|
||||
SET SESSION CHARACTERISTICS AS TRANSACTION
|
||||
[ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]
|
||||
[ ISOLATION LEVEL { READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE } ]
|
||||
[ READ WRITE | READ ONLY ]
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@ -76,8 +79,11 @@ SET SESSION CHARACTERISTICS AS TRANSACTION
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
The transaction isolation level cannot be set after the first query
|
||||
or data-modification statement (<command>SELECT</command>,
|
||||
The level <literal>READ UNCOMMITTED</literal> is mapped to
|
||||
<literal>READ COMMITTED</literal>, the level <literal>REPEATABLE
|
||||
READ</literal> is mapped to <literal>SERIALIZABLE</literal>, The
|
||||
transaction isolation level cannot be set after the first query or
|
||||
data-modification statement (<command>SELECT</command>,
|
||||
<command>INSERT</command>, <command>DELETE</command>,
|
||||
<command>UPDATE</command>, <command>FETCH</command>,
|
||||
<command>COPY</command>) of a transaction has been executed. See
|
||||
@ -122,13 +128,12 @@ SET default_transaction_isolation = '<replaceable>value</replaceable>'
|
||||
<para>
|
||||
Both commands are defined in the <acronym>SQL</acronym> standard.
|
||||
<literal>SERIALIZABLE</literal> is the default transaction
|
||||
isolation level in the standard; in <productname>PostgreSQL</productname> the default is
|
||||
ordinarily <literal>READ COMMITTED</literal>, but you can change it as
|
||||
described above. <productname>PostgreSQL</productname> does not
|
||||
provide the isolation levels <literal>READ UNCOMMITTED</literal>
|
||||
and <literal>REPEATABLE READ</literal>. Because of multiversion
|
||||
concurrency control, the <literal>SERIALIZABLE</literal> level is
|
||||
not truly serializable. See <xref linkend="mvcc"> for details.
|
||||
isolation level in the standard; in
|
||||
<productname>PostgreSQL</productname> the default is ordinarily
|
||||
<literal>READ COMMITTED</literal>, but you can change it as
|
||||
described above. Because of multiversion concurrency control, the
|
||||
<literal>SERIALIZABLE</literal> level is not truly
|
||||
serializable. See <xref linkend="mvcc"> for details.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/start_transaction.sgml,v 1.7 2003/09/09 18:28:53 tgl Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/start_transaction.sgml,v 1.8 2003/11/06 22:08:14 petere Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -20,7 +20,9 @@ PostgreSQL documentation
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
START TRANSACTION [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]
|
||||
START TRANSACTION
|
||||
[ ISOLATION LEVEL { READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE } ]
|
||||
[ READ WRITE | READ ONLY ]
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.216 2003/11/04 09:55:38 petere Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.217 2003/11/06 22:08:14 petere Exp $
|
||||
-->
|
||||
|
||||
<Chapter Id="runtime">
|
||||
@ -2043,10 +2043,12 @@ SET ENABLE_SEQSCAN TO OFF;
|
||||
<term><varname>default_transaction_isolation</varname> (<type>string</type>)</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Each SQL transaction has an isolation level, which can be either
|
||||
<quote>read committed</quote> or <quote>serializable</quote>.
|
||||
This parameter controls the default isolation level of each new
|
||||
transaction. The default is <quote>read committed</quote>.
|
||||
Each SQL transaction has an isolation level, which can be
|
||||
either <quote>read uncommitted</quote>, <quote>read
|
||||
committed</quote>, <quote>repeatable read</quote>, or
|
||||
<quote>serializable</quote>. This parameter controls the
|
||||
default isolation level of each new transaction. The default
|
||||
is <quote>read committed</quote>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
Reference in New Issue
Block a user