Created
August 15, 2013 08:53
-
-
Save tairov/6239351 to your computer and use it in GitHub Desktop.
mongodb, get jumbo chunks size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ns = "mydb.mycollection" //the full namespace of the collection | |
var key = { "su" : 1, "sd" : 1 } //the shard key of the collection | |
db.getSiblingDB("config").chunks.find({ns : ns}).forEach(function(chunk) { | |
var ds = db.getSiblingDB(ns.split(".")[0]).runCommand({datasize:chunk.ns,keyPattern:key,min:chunk.min,max:chunk.max}); | |
print("Chunk: "+chunk._id +" has a size of "+ds.size+", and includes "+ds.numObjects+" objects (took "+ds.millis+"ms)") | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment