Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slow mongodb performance: indexes on mongodb does not match the queries #3

Open
cwolters opened this issue Feb 22, 2017 · 0 comments
Open

Comments

@cwolters
Copy link

Hi.

I observed a very slow response of mongo while having a lot of thoughts in the system.
The query behind the scene is doing something like:

db.getCollection('thoughts').find({}).sort({"time":-1}).limit(1500)

There is no index on reverse time - so adding an index by:

db.thoughts.createIndex({"time":-1})

speeded the processing up to factor 10.

So you may add something like:

get('db.mongo.db').collection('thoughts').ensureIndex({app: 1, time: 1, key: 1}, done)

to indexes.js

There are some more of these missing indexes in there ... ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant