#37451 new Uncategorized

`QuerySet.get()` must not pull more than 2 rows with `DEBUG=False`

Reported by: Sobolev Nikita Owned by:
Component: Database layer (models, ORM) Version: 6.1
Severity: Low Keywords: queryset, orm, database
Cc: Sobolev Nikita Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Refs https://code.djangoproject.com/ticket/6785

Source:

While this is helpful for debug inforation, it can potentially slow down production requests. With fetching 19 more entries.
This can be especially slow in cases when full-scan is used.

I propose limitting this value to 2 with DEBUG=False. This keeps the best of two worlds:

  • Better debug inforation in DEBUG mode
  • Faster code in production

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top