summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2012-09-20 18:51:30 +0300
committerAnssi Kääriäinen <akaariai@gmail.com>2012-09-28 18:16:08 +0300
commit1cd6e04cd4f768bcd4385b75de433d497d938f82 (patch)
tree9aa9611692cd492cc6666c3c3a02df2fd2c7df91 /docs
parent3fcca0e94721a734882389ce473f522d293907e9 (diff)
Fixed #18676 -- Allow fast-path deletion of objects
Objects can be fast-path deleted if there are no signals, and there are no further cascades. If fast-path is taken, the objects do not need to be loaded into memory before deletion. Thanks to Jeremy Dunck, Simon Charette and Alex Gaynor for reviewing the patch.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/querysets.txt15
-rw-r--r--docs/releases/1.5.txt6
2 files changed, 21 insertions, 0 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index 749a979db6..d17d869164 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -1667,6 +1667,21 @@ methods on your models. It does, however, emit the
:data:`~django.db.models.signals.post_delete` signals for all deleted objects
(including cascaded deletions).
+.. versionadded:: 1.5
+ Allow fast-path deletion of objects
+
+Django needs to fetch objects into memory to send signals and handle cascades.
+However, if there are no cascades and no signals, then Django may take a
+fast-path and delete objects without fetching into memory. For large
+deletes this can result in significantly reduced memory usage. The amount of
+executed queries can be reduced, too.
+
+ForeignKeys which are set to :attr:`~django.db.models.ForeignKey.on_delete`
+DO_NOTHING do not prevent taking the fast-path in deletion.
+
+Note that the queries generated in object deletion is an implementation
+detail subject to change.
+
.. _field-lookups:
Field lookups
diff --git a/docs/releases/1.5.txt b/docs/releases/1.5.txt
index fddd03d421..5636a2b34b 100644
--- a/docs/releases/1.5.txt
+++ b/docs/releases/1.5.txt
@@ -149,6 +149,12 @@ Django 1.5 also includes several smaller improvements worth noting:
* Django now provides a mod_wsgi :doc:`auth handler
</howto/deployment/wsgi/apache-auth>`
+* The :meth:`QuerySet.delete() <django.db.models.query.QuerySet.delete>`
+ and :meth:`Model.delete() <django.db.models.Model.delete()>` can now take
+ fast-path in some cases. The fast-path allows for less queries and less
+ objects fetched into memory. See :meth:`QuerySet.delete()
+ <django.db.models.query.QuerySet.delete>` for details.
+
Backwards incompatible changes in 1.5
=====================================