Groups
Groups
Sign in
Groups
Groups
mongodb-user
Conversations
About
Send feedback
Help
$and operator seems to be causing mongo to not use index.
34 views
Skip to first unread message
Sam Martin
unread,
Sep 29, 2012, 3:01:17 PM
9/29/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
Hi all,
got a wierd problem,
using simple find on indexed attribute
{ "myatt":1234}
explained, all good using BTree index
do an
{$and :[ {myattr:1234},{myatt:1234}]}
reverts to basic cursor
any ideas?
thanks,
sam
Sam Martin
unread,
Sep 29, 2012, 6:08:53 PM
9/29/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
still cannot suss this one out.
Explain returns...
BasicCursor, nscanned 1M+
{ "$and" :
[{ "kw" :/^term }
]}
whereas
{ "kw" :/^term }
is instant, and uses the Btree cursor multi
any ideas?
Thanks
Stephen Steneker
unread,
Sep 29, 2012, 11:31:15 PM
9/29/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
still cannot suss this one out.
Hi Sam,
In your first example you were using two different fields (*myattr" and "myatt") .. are both included in the index?
Can you include the full queries and the result of explain(true) for each? Explain with the extra option will show all plans considered.
Cheers,
Stephen
Reply all
Reply to author
Forward
0 new messages