Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Indexes and multi-tenant applications in mongodb
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mguserdev  
View profile  
 More options Oct 29 2011, 12:17 pm
From: mguserdev <sqm1...@gmail.com>
Date: Sat, 29 Oct 2011 09:17:36 -0700 (PDT)
Local: Sat, Oct 29 2011 12:17 pm
Subject: Indexes and multi-tenant applications in mongodb
I am working on a multi-tenant application in which I am using a
single collection for all tenants and tracking the tenant via a
tenant_id field. All queries will include tenant_id = X as a
condition.

My question is that I've read mongodb can only use a maximum of 1
index per query. So, if an every query I already have tenant_id = X as
a condition, then that means none of my other field's indexes will
ever be used?

EG: Suppose I had a query in which tenant_id = X and foo = bar, if
mongodb is using the index on tenant_id, then I creating an index on
the 'foo' field will never be used?

Is there a best practice to deal with indexing fields in multi-tenant
applications in mongodb?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Karl Seguin  
View profile  
 More options Oct 30 2011, 1:34 am
From: Karl Seguin <karlseg...@gmail.com>
Date: Sat, 29 Oct 2011 22:34:09 -0700 (PDT)
Local: Sun, Oct 30 2011 1:34 am
Subject: Re: Indexes and multi-tenant applications in mongodb

compound indexes are you friend.

createIndex({tenant_id: 1, foo: 1})

http://mongly.com/Speedig-Up-Queries-Understanding-Query-Plans/

Might help.

Karl


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »