summaryrefslogtreecommitdiff
path: root/docs/ref/databases.txt
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-03-02 15:00:28 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-03-02 15:05:49 +0100
commite0449316ebacaa550e9c529f8c9cb9a9b44e3765 (patch)
treea3d156c5228bbc89b40183ab7e6c8a47d40878c9 /docs/ref/databases.txt
parentd63e55039d42c2ba8bb6c8f8d133ede085b60969 (diff)
Fixed #18130 -- Made the isolation level configurable on PostgreSQL.
Thanks limscoder for the report and niwi for the draft patch.
Diffstat (limited to 'docs/ref/databases.txt')
-rw-r--r--docs/ref/databases.txt35
1 files changed, 33 insertions, 2 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index 34f60e99ac..4e435949a2 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -143,8 +143,11 @@ autocommit behavior is enabled by setting the ``autocommit`` key in
the :setting:`OPTIONS` part of your database configuration in
:setting:`DATABASES`::
- 'OPTIONS': {
- 'autocommit': True,
+ DATABASES = {
+ # ...
+ 'OPTIONS': {
+ 'autocommit': True,
+ },
}
In this configuration, Django still ensures that :ref:`delete()
@@ -168,6 +171,34 @@ You should also audit your existing code for any instances of this behavior
before enabling this feature. It's faster, but it provides less automatic
protection for multi-call operations.
+Isolation level
+~~~~~~~~~~~~~~~
+
+.. versionadded:: 1.6
+
+Like PostgreSQL itself, Django defaults to the ``READ COMMITTED`` `isolation
+level <postgresql-isolation-levels>`_. If you need a higher isolation level
+such as ``REPEATABLE READ`` or ``SERIALIZABLE``, set it in the
+:setting:`OPTIONS` part of your database configuration in
+:setting:`DATABASES`::
+
+ import psycopg2.extensions
+
+ DATABASES = {
+ # ...
+ 'OPTIONS': {
+ 'isolation_level': psycopg2.extensions.ISOLATION_LEVEL_SERIALIZABLE,
+ },
+ }
+
+.. note::
+
+ Under higher isolation levels, your application should be prepared to
+ handle exceptions raised on serialization failures. This option is
+ designed for advanced uses.
+
+.. _postgresql-isolation-levels: http://www.postgresql.org/docs/devel/static/transaction-iso.html
+
Indexes for ``varchar`` and ``text`` columns
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~