MongoEngine / MongoEngine/mongoengine
Bad Performance with querying database
Open
Nobody has claimed this yet.
High Priority
Performance
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 11
Description
Hi, I have document with bad performance. I used some profiler
and you can see result
Tue Apr 4 13:02:36 2017 /tmp/profile.pstat
2399000 function calls (2399641 primitive calls) in 4.152 seconds
Ordered by: internal time
List reduced from 148 to 100 due to restriction <100>
ncalls tottime percall cumtime percall filename:lineno(function)
104/704 2.225 0.021 7.144 0.010 /env/local/lib/python2.7/site-packages/mongoengine/base/fields.py:233(ListField.to_python)
2379676 1.854 0.000 2.460 0.000 /env/local/lib/python2.7/site-packages/mongoengine/fields.py:62(StringField.to_python)
8/40 0.031 0.004 7.180 0.179 /env/local/lib/python2.7/site-packages/mongoengine/base/document.py:539(_from_son)
1 0.007 0.007 7.305 7.305 /env/local/lib/python2.7/site-packages/mongoengine/queryset/queryset.py:83(QuerySet._populate_cache)
I use pymongo for same query and load in 0.3 sec
what is problem?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the profiler output and the MongoEngine paths it names: mongoengine/base/fields.py, mongoengine/fields.py, mongoengine/base/document.py, and mongoengine/queryset/queryset.py. Compare the MongoEngine query with the reported PyMongo 0.3-second result; a useful outcome would identify the cause and define a concrete performance change, but this issue does not specify an expected fix or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- database, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100