Opened 7 years ago
Closed 7 years ago
#29117 closed Bug (duplicate)
Excessive memory use when multiple objects retrieved using objects.get()
Reported by: | caseydm | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.8 |
Severity: | Normal | Keywords: | obejcts.get |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I recently discovered a bug in my application that is running on Django 1.8.18 with python 2.7.14. This code is used to retrieve names using a slug:
try: record = record_class.objects.get(**filter_params) except record_class.MultipleObjectsReturned: # deal with multiple records
Most names are single objects, but occasionally a name like 'not provided' will come through and return 1,000 results or more. In that instance, record_class.objects.get(filter_params) spikes in memory usage from 56mb to 344mb. On Heroku, running this query a few times quickly maxes out all available memory, and the app stays that way until the dynos are restarted.
Change History (2)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
I guess that could be solved by #6785. Do you have another proposal?