1

I'm a db newb in general, looking to use mongoDB for the first time. Wondering what the performance would be like for a query similar to the following (O(n*m) complexity) on a collection with 500K-1M documents. Basically, my question is: At what collection size would one likely start seeing performance issues for a query like this? TIA

db.albums.find(
  {
    genres: 'Alternative Rock' 
  } 
) 
1
  • There isn't a good general answer. Try it with your schema and on your hardware and driver platform. Also, you'll need to consider what other indexes and queries you will want. Like, what if a search is for genre and music-decade? Commented May 4, 2013 at 12:08

2 Answers 2

4

That is a very straight-forward index-access query (if you index genres).

Just like with any other database, you'd have a B-tree index, I would not expect performance issues for 500K - 1M records.

Sign up to request clarification or add additional context in comments.

3 Comments

@lciamp: That's why he has 80k+ rep :)
@SergioTulentsev: I like to think that the quality of my answers has something to do with that as well, but I concede that speed and quantity are big factors :-)
@Thilo Hey, I was just joking around. But, yeah, your answer is actually of higher quality than mine! I think sergio was joking around too. We're all friends here!
3

It really depends. With mongo, speed comes down to indexes. If you set up an index for that query, it could happen quite fast. (even for a 1M+ query)

Ex:

db.albums.ensureIndex({'genres':-1})

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.