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 Can this query be optimized?
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
 
Alex Huang  
View profile  
 More options May 10 2012, 7:09 am
From: Alex Huang <huangzili...@gmail.com>
Date: Thu, 10 May 2012 04:09:42 -0700 (PDT)
Local: Thurs, May 10 2012 7:09 am
Subject: Re: Can this query be optimized?

try this

db.surveyResponse.find({"surveyId" : "4f39a79601bfa841a2c06272", "$nor" :
[{"interviewStatus" : -99},{"interviewStatus" : -50},{"interviewStatus" :
-60}]}).hint("surveyId":1, "interviewStatus":1)

any improvement pls do tell me.

在 2012年5月10日星期四UTC+8下午6时57分41秒,Alex Paransky写道:

> We have a query that looks like this:

> db.surveyResponse.find({"surveyId" : "4f39a79601bfa841a2c06272",

> "$nor" : [

> {

> "interviewStatus" : -99

> },

> {

> "interviewStatus" : -50

> },

> {

> "interviewStatus" : -60

> }

> ]

> }

> )

> We also have an index {surveyId:1, interviewStatus:1}

> Somewhere I read that $nor will not use index, but $or will.  Does this
> apply here? Would it be better to rewrite this query using $or?  Are there
> other ways of improving performance of this query?

> There are about 2 million documents in this table.  InterviewStatus is an
> enumeration and is sparse (about 8 integers).

> Thanks.

> -AP_


 
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.