r/DatabaseHelp • u/jay-random • Jun 19 '20
MongoDb aggregate with large number of documents?
Hey guys,
I'm using mongodb and trying to do aggregation lookup. The number of documents in the collection which is being used in "from" attribute of $lookup are in thousands. Now this is taking up all the CPU and taking a looot of time to respond.
But if i remove the documents to couple hundreds it's still slow but much much faster than earlier.
Is this normal behaviour for aggregation lookup? Should i think of something else if i have large number of documents?
Please suggest
3
Upvotes
View all comments
Show parent comment
1
u/jay-random Jun 20 '20
Thanks!
I'm currently thinking of getting the user ids from the notification collection (with pagination) and then retrieve users.
Whenever i get into this relation hell with nosql i always get lured to RDMS. :D