summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorAnže Pečar <anze@pecar.me>2024-01-23 11:51:24 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-01-30 11:42:34 +0100
commita0204ac183ad6bca71707676d994d5888cf966aa (patch)
treeaf34f0226d69a68614d3246af2d0a803f2811791 /docs/ref
parentae8baaee9d717cb48d59514b7130e35ae921d265 (diff)
Fixed #29280 -- Made the transactions behavior configurable on SQLite.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/databases.txt32
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index d98d523db5..d853647730 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -870,6 +870,38 @@ If you're getting this error, you can solve it by:
This will make SQLite wait a bit longer before throwing "database is locked"
errors; it won't really do anything to solve them.
+.. _sqlite-transaction-behavior:
+
+Transactions behavior
+~~~~~~~~~~~~~~~~~~~~~
+
+.. versionadded:: 5.1
+
+SQLite supports three transaction modes: ``DEFERRED``, ``IMMEDIATE``, and
+``EXCLUSIVE``.
+
+The default is ``DEFERRED``. If you need to use a different mode, set it in the
+:setting:`OPTIONS` part of your database configuration in
+:setting:`DATABASES`, for example::
+
+ "OPTIONS": {
+ # ...
+ "transaction_mode": "IMMEDIATE",
+ # ...
+ }
+
+To make sure your transactions wait until ``timeout`` before raising "Database
+is Locked", change the transaction mode to ``IMMEDIATE``.
+
+For the best performance with ``IMMEDIATE`` and ``EXCLUSIVE``, transactions
+should be as short as possible. This might be hard to guarantee for all of your
+views so the usage of :setting:`ATOMIC_REQUESTS <DATABASE-ATOMIC_REQUESTS>` is
+discouraged in this case.
+
+For more information see `Transactions in SQLite`_.
+
+.. _`Transactions in SQLite`: https://www.sqlite.org/lang_transaction.html#deferred_immediate_and_exclusive_transactions
+
``QuerySet.select_for_update()`` not supported
----------------------------------------------