[SERVER-32758] shard key and planSummary IDHACK Created: 18/Jan/18  Updated: 16/Nov/21  Resolved: 18/Jan/18

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: hyeonghwa park Assignee: Mark Agarunov
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

I'm using the following shard key and document in the collection, sh.status()

1. shard key:

{ "_id": 1 }

,

{ _id: "AH_25a55ce50b8dce490000000001" }


> using the following shard key and document in the collection, no problem?

2. planSummary: IDHACK:
> it is just informing that mongod has choose to use _id index. right?
no problem?

 
//sh.status()
test.sos
    shard key: { "_id": 1 }
    chunks:
      shard1: 20
      shard3: 20
      shard2: 20
 
//document in the collection      
{ _id: "AH_25a55ce50b8dce490000000001" } 
{ _id: "BH_25a55ce50b8dce490000000002" } 
{ _id: "CH_25a55ce50b8dce490000000003" } 
{ _id: "DH_25a55ce50b8dce490000000004" } 
{ _id: "EH_25a55ce50b8dce490000000005" } 
{ _id: "FH_25a55ce50b8dce490000000006" } 
{ _id: "GH_25a55ce50b8dce490000000007" } 
{ _id: "HH_25a55ce50b8dce490000000008" } 
 
//mongod.log
$query: { _id: "AH_25a55ce50b8dce490000000001" } } 
planSummary: IDHACK ntoskip:0 nscanned:1 nscannedObjects:1 idhack:1 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:1 reslen:1277 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } 0ms 
> IDHACK means that normal query plan path (evaluation, caching, re-evaluation) was bypassed for the query shape {_id: <value>} which is supported by the required _id index. 
  this is a performance optimization for the common use case of fetching a document by primary key.

Thanks,
hyeongwa



 Comments   
Comment by Mark Agarunov [ 18/Jan/18 ]

Hello parkhyeonghwa,

Thanks for your report. Please note that SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-user group.

Thanks,
Mark

Generated at Thu Feb 08 04:31:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.