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 Using hint() in a sharded environment
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
 
Kev  
View profile  
 More options Dec 31 2011, 4:12 pm
From: Kev <kevins...@gmail.com>
Date: Sat, 31 Dec 2011 13:12:33 -0800 (PST)
Local: Sat, Dec 31 2011 4:12 pm
Subject: Using hint() in a sharded environment
I have a table, mytable with indexes hash_1__id_1 and hash_1_uid_1.
The shard key of the table is hash_1__id_1.

By executing the following query:
db.mytable.find({'hash' : 1234, 'uid', 1111})
using explain i see that it is actually using the hash_1__id_1 index
instead of the hash_1_uid_1.

Is this because of the fact that hash_1__id_1 is the sharded key?  I
tried to force it to use the other index to see if it is faster as
follows:

db.mytable.find({'hash' : 1234, 'uid', 1111}).hint("hash_1_uid_1")

but that results in an error:

Sat Dec 31 16:03:42 uncaught exception: error: {
        "$err" : "could not initialize cursor across all shards because : bad
hint @ database5/shard5:27018,shard5r:27018",
        "code" : 14827

}

Is this a problem with my shard key?  Or is there a way around this.

Much appreciated and happy new year!


 
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.