Opened 7 years ago

Closed 7 years ago

#7854 closed (wontfix)

get_list_or_404 slice performance

Reported by: Sanha Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords: shortcuts, performance
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


in this case,


Performance is optimized by SQL.
but in this case,

get_list_or_404(Foo, name__startswith="peter")[:10]

This slice is done by Python.
This is proformance issue.

Is it possible shortcuts can do slice by SQL ?

Change History (1)

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

The get_list_or_404 method is shortcut for simple filters. If you want more complex querysets and if slicing in Python isn't acceptable for your particular use-case, then just do it by hand. It's not worth complicating get_list_or_404 for this situation.

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