Skip to content

Commit 525e51f

Browse files
CodeQuiverjacobtylerwalls
authored andcommitted
Fixed #35596 -- Removed mention of unlimited results from QuerySet.get().
Obsolete since 330638b.
1 parent 4a5e90c commit 525e51f

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

docs/topics/db/optimization.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,10 @@ Doing the following is potentially quite slow:
189189
First of all, ``headline`` is not indexed, which will make the underlying
190190
database fetch slower.
191191

192-
Second, the lookup doesn't guarantee that only one object will be returned.
193-
If the query matches more than one object, it will retrieve and transfer all of
194-
them from the database. This penalty could be substantial if hundreds or
195-
thousands of records are returned. The penalty will be compounded if the
196-
database lives on a separate server, where network overhead and latency also
197-
play a factor.
192+
Second, the lookup may return multiple results. Even though Django applies a
193+
limit of 21 objects when using :meth:`~django.db.models.query.QuerySet.get`,
194+
the database may still need to scan everything to evaluate a non-unique
195+
condition. Narrowing your query up-front is more efficient.
198196

199197
Retrieve related objects efficiently
200198
====================================

0 commit comments

Comments
 (0)