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

Querying of subscribers from MongoDB is "slow" #977

Closed
proDOOMman opened this issue Aug 8, 2022 · 1 comment
Closed

Querying of subscribers from MongoDB is "slow" #977

proDOOMman opened this issue Aug 8, 2022 · 1 comment

Comments

@proDOOMman
Copy link
Contributor

I find in logs many messages with text:

{"t":{"$date":"2022-08-08T09:21:54.466+00:00"},"s":"I", "c":"COMMAND", "id":51803, "ctx":"conn1","msg":"Slow query","attr":{"type":"command","ns":"novu-db.subscribers","command":{"find":"subscribers","filter":{"_environmentId":{"$oid":"62a326e670c45900183eee85"},"subscriberId":"338c823d-19f9-4868-ab60-daa1ad1a0bd6","deleted":{"$ne":true}},"projection":{},"limit":1,"singleBatch":true,"batchSize":1,"returnKey":false,"showRecordId":false,"lsid":{"id":{"$uuid":"2a13f3d1-f82b-41ca-bbd4-9b960db0195a"}},"$db":"novu-db"},"planSummary":"IXSCAN { _environmentId: 1 }","keysExamined":48010,"docsExamined":48010,"cursorExhausted":true,"numYields":49,"nreturned":1,"queryHash":"DB51AD35","planCacheKey":"D1C4E6BC","reslen":425,"locks":{"Global":{"acquireCount":{"r":50}},"Mutex":{"acquireCount":{"r":1}}},"storage":{},"remote":"127.0.0.1:53042","protocol":"op_msg","durationMillis":215}}

Is this a problem? May be we should add index for (_environmentId, subscriberId)

@scopsy
Copy link
Contributor

scopsy commented Aug 8, 2022

We actually have this index on the hosted version, but looks like it's missing in the DAL configuration as a default index. So I think adding a compound index with mongoose there will solve the issue.

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

2 participants