Opened 8 years ago

Closed 8 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 8 years ago by Malcolm Tredinnick

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: wontfix
Status: newclosed

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