Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: add index to collections #109

Merged
merged 3 commits into from
Dec 9, 2021
Merged

Conversation

gabaldon
Copy link
Collaborator

@gabaldon gabaldon commented Dec 2, 2021

Fix #65

@Tommytrg
Copy link
Member

Tommytrg commented Dec 2, 2021

@aesedepece , as our mongodb guru, do you think we should add any other index to improve the performance?

@aesedepece aesedepece linked an issue Dec 2, 2021 that may be closed by this pull request
@@ -13,6 +13,7 @@ export class ResultRequestRepository {

constructor (db: Db, _dataFeeds: Array<FeedInfo>) {
this.collection = db.collection('result_request')
this.collection.createIndex({ feedFullName: 1 })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ResultRequest we are looking also for timestamp: { $gt: timestamp.toString() } so the index should include it:

Suggested change
this.collection.createIndex({ feedFullName: 1 })
this.collection.createIndex({ feedFullName: 1, timestamp: -1 })

@aesedepece aesedepece merged commit 1d7cc85 into witnet:main Dec 9, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Leverage MongoDB indexes for speeding up the app
3 participants