Creating an index on mLab for a Meteor Collection

Hey guys,

One of my app’s collections has already 10.000+ documents - and I’m considering the idea of creating an index to increase lookup speed. Since I’ve never done this before, I’d like to know if someone could just briefly summarize to me (and to everyone searching for this topic in the future):

1 - The process.
According to mLab, all I need is to create the index in their platform. Is this true, or is any action in the Meteor-side necessary? Will my lookups ( .find() etc. ) remain the same, or do I need to change selectors and other parameters?

2 - Best practices.
Any tips on how to extract the most from an index in terms of performance, while keeping the space increase low?

Thanks!

Here is the classic “check out the docs” comment, but here is some great documentation on indices from Mongo. The documenation from mLab is also great. They both do a much better job of explaining all the intricacies than I could.

Creating your indices on mLab will work perfectly fine, and your queries should remain the same.

One feature from mLab that I have found to be invaluable is their “Slow Queries” tab. It lets you know about possible indices that you are missing based on query performance, and recommends indices that could improve it. One caveat being I wouldn’t always take their recommendations, since there may be more efficient ways to improve the performance of the queries.

2 Likes