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
Message from discussion Index Usage Questions: does find({ field_a}.sort({field_b} use index (fielda, fieldb) ?
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
 
Kevin Rice  
View profile  
 More options Oct 11 2012, 11:39 am
From: Kevin Rice <justany...@gmail.com>
Date: Thu, 11 Oct 2012 08:39:21 -0700 (PDT)
Local: Thurs, Oct 11 2012 11:39 am
Subject: Index Usage Questions: does find({ field_a}.sort({field_b} use index (fielda, fieldb) ?

Hello!

Question re: index usage - I may have extraneous indexes if Mongo isn't
using them, thus a slowdown on insert/update, thus the question:

My sharded, replicated collection has uniform records with fields FieldA
and FieldB.  There are two indexes on this collection:  

   - IndexOne has key FieldA only.
   - IndexTwo has keys FieldA and FieldB.

Questions:

   1. On a db.collectionName.find({ 'FieldA' : 999}), I would figure Index
   IndexOne would be used.
   2. If IndexOne didn't exist and I did db.collectionName.find({ 'FieldA'
   : 999}), I would figure Index IndexTwo would be used.
   3. If I do db.collectionName.find({'FieldA':999}).sort({'FieldB': 1})  
   (plus or minus syntax here), which index would be used?  
   4. If IndexOne doesn't exist, can the find().sort() call use IndexTwo?
   5. In Postgres, I can do an 'analyze explain <queryOne>' that shows me
   what index it uses for queryOne.  How do I do this in Mongo?


 
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.