Analyze oplog.rs collection to calculate space used by each name space

Hi @Kamal_Parshotam,

Since oplog entries only include document insertions and changes (and a rolling history), this may not be a useful indication of actual document size. A $group query on the oplog will also be a full collection scan and may have some performance impact on a production system.

You could use db.collection.stats().avgObjSize to quickly get the average document size for a collection (similar to your query which is getting the BSON size of oplog entries), however the storage size would likely be much less with compression.

Regards,
Stennie

1 Like