summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorCodeQuiver <38484031+CodeQuiver@users.noreply.github.com>2026-05-18 17:26:31 -0700
committerJacob Walls <jacobtylerwalls@gmail.com>2026-05-27 16:37:11 -0400
commit525e51f6ce7d77012b60a9bdbd098322f94bdd3f (patch)
tree811a31d5c70c886f16085247f7fecfe50043ab27 /docs/topics
parent4a5e90c3edf10969c0efb259278def20347b151d (diff)
Fixed #35596 -- Removed mention of unlimited results from QuerySet.get().
Obsolete since 330638b89f14e1fb06e9d313ccc9768ae167c53f.
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/db/optimization.txt10
1 files changed, 4 insertions, 6 deletions
diff --git a/docs/topics/db/optimization.txt b/docs/topics/db/optimization.txt
index 9c4ba314ae..ed990a123f 100644
--- a/docs/topics/db/optimization.txt
+++ b/docs/topics/db/optimization.txt
@@ -189,12 +189,10 @@ Doing the following is potentially quite slow:
First of all, ``headline`` is not indexed, which will make the underlying
database fetch slower.
-Second, the lookup doesn't guarantee that only one object will be returned.
-If the query matches more than one object, it will retrieve and transfer all of
-them from the database. This penalty could be substantial if hundreds or
-thousands of records are returned. The penalty will be compounded if the
-database lives on a separate server, where network overhead and latency also
-play a factor.
+Second, the lookup may return multiple results. Even though Django applies a
+limit of 21 objects when using :meth:`~django.db.models.query.QuerySet.get`,
+the database may still need to scan everything to evaluate a non-unique
+condition. Narrowing your query up-front is more efficient.
Retrieve related objects efficiently
====================================