[SERVER-2174] support db.stats(1024*1024) Created: 03/Dec/10  Updated: 12/Jul/16  Resolved: 04/Apr/11

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

Type: Improvement Priority: Trivial - P5
Reporter: Alvin Richards (Inactive) Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

In the same way you can do db.cool.stats(1024*1024)



 Comments   
Comment by auto [ 04/Apr/11 ]

Author:

{u'login': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: support scale option to dbstats command SERVER-2174
Branch: master
https://github.com/mongodb/mongo/commit/fa7fbbb1f66ec5e189f6deba58564b72c2e4cbef

Comment by Adrien Mogenet [ 30/Jan/11 ]

Concerned by Pull Request #20 : https://github.com/mongodb/mongo/pull/20

Comment by Adrien Mogenet [ 27/Jan/11 ]

Allright... now I know what to do this week-end

Comment by Scott Hernandez (Inactive) [ 27/Jan/11 ]

Yes, but if you don't change the default at the server, but at the shell there is less chance of that.

It might be breaking... but much more usable for interactive use.

Comment by Adrien Mogenet [ 27/Jan/11 ]

Go => Gb (Sorry, I was thinking in French with French units )

Set the "human" option as default could impact scripts which are parsing these values, no ?

Comment by Scott Hernandez (Inactive) [ 27/Jan/11 ]

Yeah, that could be useful. I'd even argue that the shell should use that as the default formatting.

What is the measurement "Go"? Is that a language thing?

I'd lean towards human as the option name; who doesn't wants their stats to be more "human"?

Comment by Adrien Mogenet [ 27/Jan/11 ]

Ok, thanks for this information Scott !

I was working on a human-readable option from the shell, auto-adjusting units and decimal values.

MongoShell :
> db.c.stats(

{ autounit: True }

)

...
"avgObjSize" : 8.756 ko,
"storageSize" : 32,6 Go,
"totalIndexSize": 24,1 Go
...

Could it be useful ?

Comment by Scott Hernandez (Inactive) [ 27/Jan/11 ]

The value passed in is used to divide the number of bytes by, the scale That value would get you MB, yes. Rounding is important here.

> db.c.stats
function (scale) {
return this._db.runCommand(

{collstats:this._shortName, scale:scale}

);

> db.thumbnails.stats(1024)
{
"ns" : "davpix.thumbnails",
"count" : 101,
"size" : 856,
"avgObjSize" : 8.475247524752476,
"storageSize" : 204800,
"numExtents" : 1,
"nindexes" : 0,
"lastExtentSize" : 204800,
"paddingFactor" : 1,
"flags" : 0,
"totalIndexSize" : 0,
"indexSizes" : {

},
"capped" : 1,
"max" : 2147483647,
"ok" : 1
}
> db.thumbnails.stats(1024*1024)
{
"ns" : "davpix.thumbnails",
"count" : 101,
"size" : 0,
"avgObjSize" : 0,
"storageSize" : 200,
"numExtents" : 1,
"nindexes" : 0,
"lastExtentSize" : 200,
"paddingFactor" : 1,
"flags" : 0,
"totalIndexSize" : 0,
"indexSizes" : {

},
"capped" : 1,
"max" : 2147483647,
"ok" : 1
}

Comment by Adrien Mogenet [ 27/Jan/11 ]

Not sure to get it. Do you want to be able to display stats in megabytes ?

Generated at Thu Feb 08 02:59:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.