Opened 11 years ago

Closed 11 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: no UI/UX: no


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

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