From fc2b1cc926e34041953738e58fa6ad3053059b22 Mon Sep 17 00:00:00 2001 From: Saad Date: Fri, 25 Oct 2019 00:39:12 +0300 Subject: [PATCH] Fixed #30904 -- Doc'd caveat about using filtered queryset with select_for_update() on MySQL. --- docs/ref/databases.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index 1667e911e2..5813fc03e6 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -630,6 +630,11 @@ the ``SELECT ... FOR UPDATE`` statement. If ``select_for_update()`` is used with ``nowait=True``, ``skip_locked=True``, or ``of`` then a :exc:`~django.db.NotSupportedError` is raised. +When using ``select_for_update()`` on MySQL, make sure you filter a queryset +against at least set of fields contained in unique constraints or only against +fields covered by indexes. Otherwise, an exclusive write lock will be acquired +over the full table for the duration of the transaction. + Automatic typecasting can cause unexpected results --------------------------------------------------